DataSet, SqlDataAdaptor.Fill?

  • Thread starter Thread starter Iwan Petrow
  • Start date Start date
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.
 
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
 
Back
Top