Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

read stored procedure results into datagrids

Posted on 2005-04-07
3
Medium Priority
?
143 Views
Last Modified: 2010-04-23
I have strored procedures that have multiple select statements. I need to be able to run the store procedure and take the result set and add each to their own datagrid. I wont know how many select statements are in the store procedure until it is ran. What would be the best way to go about this and how?  Datareader? DataAdapter? any examples? Thanks in advance.
0
Comment
Question by:MadIce
  • 2
3 Comments
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 13728547
Use a dataadapter and a dataset, it will read in all the tables that come from the stored procedure automatically

0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 1600 total points
ID: 13728670
So something like

        Dim SCM As New SqlClient.SqlCommand
        SCM.CommandType = CommandType.StoredProcedure
        SCM.CommandText = "PROJandPERSONS"
        SCM.Connection = SqlConnection1

        Dim da As New SqlClient.SqlDataAdapter(SCM)
        da.Fill(ds)

        datagrid1.datasource = ds.Tables(0)
        datagrid2.datasource = ds.Tables(1)
0
 

Author Comment

by:MadIce
ID: 13738640
Sorry it took so long to respond...My server went down and had to fix it before I could try this out. This Should workout. Thanks alot
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question