Tuesday, March 20, 2012
:. DataSet to Reporting Service
I need to pass a DataSet created in a WebForm to a Reporting Service, Cos'
my DataSet is Modeled like I want to see in the report.
My question is: How i can to pass this DataSet to Reporting Service and
this reports interact whith it?
Thanks in advance.
José AbadYou have two options. You can write a data processing extension
(non-trivial) or you can use the new VS 2005 webform control in local mode.
In local mode you give it the dataset and the report and the rendering is
done with the control. No server needed or allowed if in local mode. For
anything other than a basic report this is also non-trivial.
Third option is to not do this. Create a stored procedure and call that from
RS. RS is not architected to easily do what you want. Or, if this is a hard
and fast requirement then consider looking at other reporting tools.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"José Abad" <JosAbad@.discussions.microsoft.com> wrote in message
news:246AADF0-9D54-4648-8A00-68E81698BE61@.microsoft.com...
> Hi to ev'dy:
> I need to pass a DataSet created in a WebForm to a Reporting Service, Cos'
> my DataSet is Modeled like I want to see in the report.
> My question is: How i can to pass this DataSet to Reporting Service and
> this reports interact whith it?
>
> Thanks in advance.
> José Abad
>
Tuesday, March 6, 2012
.NET CLR stored procedure capabilities
procedure. But the option to add a typed DataSet to the project
doesn't exist. Am I missing something? Or are .NET CLR stored
procedures not all they're hyped up to be?
Todd
toddpiltingsrud@.altoconsulting.com wrote in
news:1132776964.626979.93470@.g47g2000cwa.googlegro ups.com:
> I've want to create a typed DataSet and use it inside a .NET CLR
> stored procedure. But the option to add a typed DataSet to the
> project doesn't exist. Am I missing something? Or are .NET CLR
> stored procedures not all they're hyped up to be?
Course you can create a typed DataSet and use it in SQLCLR. Younhave to
create it manually though instead of drag 'n drop.
Just out of curiousity; why do you want a typed dataset inside SQL
Server?
Niels
**************************************************
* Niels Berglund
* http://staff.develop.com/nielsb
* nielsb@.no-spam.develop.com
* "A First Look at SQL Server 2005 for Developers"
* http://www.awprofessional.com/title/0321180593
**************************************************
.NET CLR stored procedure capabilities
procedure. But the option to add a typed DataSet to the project
doesn't exist. Am I missing something? Or are .NET CLR stored
procedures not all they're hyped up to be?
Toddtoddpiltingsrud@.altoconsulting.com wrote in
news:1132776964.626979.93470@.g47g2000cwa.googlegroups.com:
> I've want to create a typed DataSet and use it inside a .NET CLR
> stored procedure. But the option to add a typed DataSet to the
> project doesn't exist. Am I missing something? Or are .NET CLR
> stored procedures not all they're hyped up to be?
Course you can create a typed DataSet and use it in SQLCLR. Younhave to
create it manually though instead of drag 'n drop.
Just out of curiousity; why do you want a typed dataset inside SQL
Server?
Niels
****************************************
**********
* Niels Berglund
* http://staff.develop.com/nielsb
* nielsb@.no-spam.develop.com
* "A First Look at SQL Server 2005 for Developers"
* http://www.awprofessional.com/title/0321180593
****************************************
**********
.NET CLR stored procedure capabilities
procedure. But the option to add a typed DataSet to the project
doesn't exist. Am I missing something? Or are .NET CLR stored
procedures not all they're hyped up to be?
Toddtoddpiltingsrud@.altoconsulting.com wrote in
news:1132776964.626979.93470@.g47g2000cwa.googlegroups.com:
> I've want to create a typed DataSet and use it inside a .NET CLR
> stored procedure. But the option to add a typed DataSet to the
> project doesn't exist. Am I missing something? Or are .NET CLR
> stored procedures not all they're hyped up to be?
Course you can create a typed DataSet and use it in SQLCLR. Younhave to
create it manually though instead of drag 'n drop.
Just out of curiousity; why do you want a typed dataset inside SQL
Server?
Niels
**************************************************
* Niels Berglund
* http://staff.develop.com/nielsb
* nielsb@.no-spam.develop.com
* "A First Look at SQL Server 2005 for Developers"
* http://www.awprofessional.com/title/0321180593
**************************************************
.NET class to hold single disconnected record? Nothing smaller than DataSet?
What is the most efficient standalone .NET class that can hold a single disconnected record? The class must also retain column names, but other schema is not relevant (.NET data type is sufficient).
If I understand System.Data.Common.DbDataRecord, it provides an interface on a DbDataReader, and has no storage of its own.
I'm familiar with DataSet, is that the only .NET-standard class to do this?
Thank you,
Shannon
Why not create a normal class with properties and fill it from a SqlDataReader, or use a OR-Mapper..?
|||I second N Frederick 's suggestiong, nothing will be faster (or easier) than a datareader populating a regular class
|||Thanks for your reply. If I understand correctly, you are suggesting that in most application-specific design scenarios, a strongly-typed class representing my scenario data object is proscribed? "normal class" assumes that I would benefit from get/set properties for myself to code against. And O/R mapper suggestion to accomplish the same.
I'm building a generic server control (an in-place editor with HTML client-side functionality). I just want something to do table-based forms against for now.
My comment that I need to store data type and column name result from the fact that I won't know at design-time (of the server control) what they are.
p.s. If you are aware of a free .NET library to do this already, I'm all ears.
TwasBrillig:
you are suggesting that in most application-specific design scenarios, a strongly-typed class representing my scenario data object is proscribed? "normal class" assumes that I would benefit from get/set properties for myself to code against. And O/R mapper suggestion to accomplish the same
Speaking for myself, I wouldn't overanalyze. The requirement you gave originally is very simple, so solve it with something very simple. OTOH....
TwasBrillig:
comment that I need to store data type and column name result from the fact that I won't know at design-time (of the server control) what they
that's a different story, if you don't know at design time what you're getting back then you can't put it in a predefined class. I suspect that your requirements are much more complex than yo've get on![]()
dbland07666:
TwasBrillig:
you are suggesting that in most application-specific design scenarios, a strongly-typed class representing my scenario data object is proscribed? "normal class" assumes that I would benefit from get/set properties for myself to code against. And O/R mapper suggestion to accomplish the same
Speaking for myself, I wouldn't overanalyze. The requirement you gave originally is very simple, so solve it with something very simple. OTOH...
That's the second cryptic reply that implies in an offhand way that the answer is simple, but doesn't answer. I hear you, the answer is 42. But what does it mean? Sure I'd love to do something very simple; What is very simple to store one record, for goodness sake? A DataSet? That was my question.
dbland07666:
TwasBrillig:
comment that I need to store data type and column name result from the fact that I won't know at design-time (of the server control) what they
that's a different story, if you don't know at design time what you're getting back then you can't put it in a predefined class. I suspect that your requirements are much more complex than yo've get on
Not knowing the type is different from not knowing the structure. A record. One table record. Sure I can build a class myself to do it, I can iterate through columns and store Column-name:Object pairs in a dictionary list, and inspect later what type is in the box. No, my requirements aren't more complex. But my question is: Is there a class already in the .NET library to hold one record, one I can copy one record into with a single method call? When I'm done I have one record in storage, and can disconnect my DbDataReader and think about my one record, its columns' values, its columns' data types, and their names for as long as I like?
|||Here are the types in ADO.Net that you can use:
DataSet = Table, rows and columns, a disconnected resultset that more or less reflects a databas but in memory.
DataReader = Need a connection and will read a row on command, so it will only stay at a specific position and move to the next recoed when you ask it to do it. See it as a Row, Column based object.
You can also use DataSet with XML etc.
Then you can create your own classes (custom business objects "entities"), such as a Customer, Product etc.
In your case where you specify that you can't use a custom class, I think you should simply use a DataSet.
|||Thank you Fredrik, that absolutely answered my question. I appreciate you taking your time answering something so basic.
I felt like there must be another class out there that I had overlooked in the library, or some other magic to DbDataRecord that I wasn't aware of.
If I'm not mistaken, I could reliably use DataReader to access the current row after disconnecting it if I only ever asked it for the values, and not any schema information (such as column name or data type).
Thanks again!
Saturday, February 11, 2012
(system) Variable that holds the record count of a result set?
Hello
is there a variable that is available to me that contains the number
of rows contained in a dataset return from a database call?
have a class that runs a stored proc and returns a dataset/resultset
looking to simply assign an integer this value if it is possible
i'm using (learning) vb.net and sql server
thanks in advance
If you are using a dataset, you can get the number of rows with this syntax:DataSet1.tables(0).rows.count (assuming your Dataset returns only 1 resultset. If you have more than 1, just replace the zero with whatever index you need.)
If you use a DataReader, which tends to be faster, this property is not available, unfortunately.|||
hello. thank you for the reply. that is exactly what i was looking for (DataSet1.tables(0).rows.count). a question about how to reference this from the codebehind...
i have a codebehind that Dims a class, the class returns the dataset, in the codebehind i have a line likeDropDownList1.DataSource = myClass.function1(parm1) to populate the dropdown with the data from the dataset. i get how i could reference this value in the class code, but how would i reference it in the codebehind? is there a way. would i have to do it in the class function and store it in a session variable or something? would be like to reference it directly in the codebehind as that is where i would be using the value.
thanks again.
|||i believe i have figured my question out (yup, i'm new), but if you have any comments i'd appreciate it
instead of directly coding the line as DDL1.DataSource = myClass.function1(parm1)
i modified the code to have...
Dim ds as dataSet = myClass.function1(parm1)
Dim dsCnt as integer = ds.Tables(0).Rows.Count()
DDL1.DataSource = ds
this seemed to get me what i was after. if there is a more efficient or elegant way to do this, i'm all ears![]()
|||The way you've done it is fine. An alternative is to create a property of type dataset in your class, then fill that property in your function. The code behind could then reference your property.
Public Class myClass
Private mMyDataset as dataset
Public Sub New()
MyBase.new()
End Sub
Property MyDataset() As dataset
Get
Return mMyDataset
End Get
Set(ByVal Value As dataset)
mMyDataset = Value
End Set
End Property
Public Sub function1(param) 'can change to a sub since you are filling a property rather than using a return value
myDataset = Database call goes here
End Sub
From your code behind:
dim objClass as new myClass()
with objClass
.function1(param)
DDL1.datasource = .myDataset
DDL1.databind
end with