• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 147
  • Last Modified:

read stored procedure results into datagrids

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
MadIce
Asked:
MadIce
  • 2
1 Solution
 
RonaldBiemansCommented:
Use a dataadapter and a dataset, it will read in all the tables that come from the stored procedure automatically

0
 
RonaldBiemansCommented:
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
 
MadIceAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now