How to generate a dataset from stored procedure which have many resultsets?

A

abc my vclass

How to generate a dataset from stored procedure which have many resultsets?

I try Dataset designer from VS2005, it only generate first table from stored
procedure on server explorer. Another table cannot to generate. How should
I do?
 
G

Guest

If you use following code (and in your STORE_PROCEDURE there are
multi-queries), you can fill dataset with multi-tables.

DataSet ds = new DataSet();
SqlConnection conn = new SqlConnection(CONNECTION_STRING);
SqlDataAdapter dap = new SqlDataAdapter();
SqlCommand command = conn.CreateCommand();
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "STORE_PROCEDURE_NAME";

// add parameters if any

dap.SelectCommand = command;
dap.Fill(ds);

HTH

Elton Wang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top