PC Review


Reply
Thread Tools Rate Thread

How to: Can you build a Typed DataSet for a stored procedure w/o using a DataAdapter?

 
 
Eric
Guest
Posts: n/a
 
      14th Dec 2004
If you want to create a DataSet, you can drag tables from Server explorer
into it, but not stored procedures. Is there any other way than using a
DataAdapter and calling Generate DataSet to get a typed dataSet that uses
sprocs instead of tables?

p.s. Does anyone know if in VS 2005 you will be able to drag and drop sprocs
onto a DataSet object?


 
Reply With Quote
 
 
 
 
David Browne
Guest
Posts: n/a
 
      14th Dec 2004

"Eric" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> If you want to create a DataSet, you can drag tables from Server explorer
> into it, but not stored procedures. Is there any other way than using a
> DataAdapter and calling Generate DataSet to get a typed dataSet that uses
> sprocs instead of tables?


Yes. It may seem terribly obvious, but use the DataSet designer and just do
it by hand.

If you don't want to do that, write a view which returns the same row type
and drag that into the DataSet designer. I always write views to "publish"
the row type returned by functions and stored procedures.

>
> p.s. Does anyone know if in VS 2005 you will be able to drag and drop
> sprocs
> onto a DataSet object?
>


The problem is that it's difficult to get SqlServer to return table metadata
information from a stored procedure. It tries to run the proc with SET
FMTONLY ON, but it's complicated and unreliable.

David


 
Reply With Quote
 
Robbe Morris - Microsoft MVP C#
Guest
Posts: n/a
 
      15th Dec 2004
If you want do this without typed datasets but still get intellisense in
your returned results, you could utilize this ADO.NET code generator
(includes source code) at eggheadcafe.

http://www.eggheadcafe.com/articles/..._generator.asp


--
Free Business Icons And Graphics
http://www.eggheadcafe.com/free_grap...lt.asp?start=1


"Eric" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> If you want to create a DataSet, you can drag tables from Server explorer
> into it, but not stored procedures. Is there any other way than using a
> DataAdapter and calling Generate DataSet to get a typed dataSet that uses
> sprocs instead of tables?
>
> p.s. Does anyone know if in VS 2005 you will be able to drag and drop
> sprocs
> onto a DataSet object?
>
>



 
Reply With Quote
 
Mythran
Guest
Posts: n/a
 
      15th Dec 2004

"Eric" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> If you want to create a DataSet, you can drag tables from Server explorer
> into it, but not stored procedures. Is there any other way than using a
> DataAdapter and calling Generate DataSet to get a typed dataSet that uses
> sprocs instead of tables?
>
> p.s. Does anyone know if in VS 2005 you will be able to drag and drop
> sprocs
> onto a DataSet object?
>
>


What?!? I can drag-n-drop sprocs from SQL Server 2000 onto a DataSet just
fine, and it creates the typed dataset with the results the stored procedure
returns along with their data types just as if it were a table. I'm using
VS 2003...what are you using?

Mythran


 
Reply With Quote
 
Eric
Guest
Posts: n/a
 
      16th Dec 2004

"David Browne" <davidbaxterbrowne no potted (E-Mail Removed)> wrote in
message news:e$(E-Mail Removed)...
>


--- Stuff deleted for Brevity

>
> The problem is that it's difficult to get SqlServer to return table

metadata
> information from a stored procedure. It tries to run the proc with SET
> FMTONLY ON, but it's complicated and unreliable.
>
>


Tell me about it. In Crystal Reports, when you attempt to set the
DataSource.Location Property of a report in code, if it's a sproc, it
actually executes the sproc in question whereas if it's a table it makes
some quick system calls to get metadata. I dont even think SET FMTONLY ON
was used. For a report against a giant database that was.....problematic,
especially if there were multiple tables in the report.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill typed dataset with one stored procedure call =?Utf-8?B?R2VuZQ==?= Microsoft ADO .NET 3 17th Nov 2007 06:23 PM
Typed dataset with stored procedure Chris Microsoft ASP .NET 0 1st Mar 2007 05:04 PM
Re: Typed DataSet and Stored Procedure Mythran Microsoft ADO .NET 0 25th Aug 2004 06:10 PM
Re: Typed DataSet and Stored Procedure David Browne Microsoft ADO .NET 0 25th Aug 2004 06:07 PM
Typed dataset via stored procedure. Jim Boyd Microsoft ADO .NET 1 26th Aug 2003 09:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:18 AM.