Home All Groups Group Topic Archive Search About

How display Result from sqlCommand select in the Datagridview

Author
23 Mar 2006 10:03 AM
Manfred
Hi all

How can I display the result of a sqlcommand select in a datagridview.

I guess need a dataset as result to connet it as datasource to the
datagrid?


Thanks in advance

Manfred

Author
23 Mar 2006 11:25 AM
Cor Ligthert [MVP]
Manfred,

Yes,  in fact the most simple a datatable.

Use a sqldataadapter to fill that dataset

Cor

Show quoteHide quote
"Manfred" <m**@USENEThsk.ch> schreef in bericht
news:uxiNbEmTGHA.4436@TK2MSFTNGP10.phx.gbl...
> Hi all
>
> How can I display the result of a sqlcommand select in a datagridview.
>
> I guess need a dataset as result to connet it as datasource to the
> datagrid?
>
>
> Thanks in advance
>
> Manfred
Author
23 Mar 2006 12:24 PM
Manfred
How can I get the data from the datareader object into the datatable? As
I assume the only way to retrieve the data from the command object is
the datareader Object, is this right? I'm new to vb.net.



regards

Manfred

Cor Ligthert [MVP] wrote:

Show quoteHide quote
> Manfred,
>
> Yes,  in fact the most simple a datatable.
>
> Use a sqldataadapter to fill that dataset
>
> Cor
>
> "Manfred" <m**@USENEThsk.ch> schreef in bericht
> news:uxiNbEmTGHA.4436@TK2MSFTNGP10.phx.gbl...
> > Hi all
> >
> > How can I display the result of a sqlcommand select in a datagridview.
> >
> > I guess need a dataset as result to connet it as datasource to the
> > datagrid?
> >
> >
> > Thanks in advance
> >
> > Manfred
>
>
Author
23 Mar 2006 2:02 PM
Cor Ligthert [MVP]
Manfred,

The datareader you would only use if you have to do things sequential.

For normal fetching of data you use in Net the DataAdapter, or the
TableAdapter.

The TableAdapter wraps the DataAdapter.
The DataAdapter wraps for getting the data the DataReader

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.aspx

I hope this gives some ideas

Cor


Show quoteHide quote
"Manfred" <m**@USENEThsk.ch> schreef in bericht
news:%23sfpGTnTGHA.4384@tk2msftngp13.phx.gbl...
> How can I get the data from the datareader object into the datatable? As
> I assume the only way to retrieve the data from the command object is
> the datareader Object, is this right? I'm new to vb.net.
>
>
>
> regards
>
> Manfred
>
> Cor Ligthert [MVP] wrote:
>
>> Manfred,
>>
>> Yes,  in fact the most simple a datatable.
>>
>> Use a sqldataadapter to fill that dataset
>>
>> Cor
>>
>> "Manfred" <m**@USENEThsk.ch> schreef in bericht
>> news:uxiNbEmTGHA.4436@TK2MSFTNGP10.phx.gbl...
>> > Hi all
>> >
>> > How can I display the result of a sqlcommand select in a datagridview.
>> >
>> > I guess need a dataset as result to connet it as datasource to the
>> > datagrid?
>> >
>> >
>> > Thanks in advance
>> >
>> > Manfred
>>
>>
>