DataSet, SqlDataAdaptor.Fill?

I

Iwan Petrow

Hi,

I have the following situation:
Two tables with relation:

T1:
Id_T1:primary key
Data1_T1
Data2_T2
Id_T2:Secondary key

T2:
Id_T2:primary key
Data1_T2

I've created typed DataSet, which includes both tables and the relation
between them.

And now the question: I want to fill this dataset using SqlDataAdaptor
with select command which is Store procedure on the server. Is this
possible and how could I do it? Or I have to use Visual Studio wizards
to generate SqlDataAdaptor and the select statement? I prefer first (if
it is possible)?

Thanks.
 
R

Reshma Prabhu

Hi,


Create SqlAdapterclass giving SqlCommand as input. This SqlCommand
object will have CommandText property set to storedProcedure name and
CommandType property set to CommandType.StoredProcedure.

Then use SqlAdapter's Fill method to load dataset.

Hope this helps.

Reshma
 

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