How display Result from sqlCommand select in the Datagridview

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Manfred

    #1

    How display Result from sqlCommand select in the Datagridview

    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
  • Cor Ligthert [MVP]

    #2
    Re: How display Result from sqlCommand select in the Datagridview

    Manfred,

    Yes, in fact the most simple a datatable.

    Use a sqldataadapter to fill that dataset

    Cor

    "Manfred" <mm1@USENEThsk. ch> schreef in bericht
    news:uxiNbEmTGH A.4436@TK2MSFTN GP10.phx.gbl...[color=blue]
    > 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[/color]


    Comment

    • Manfred

      #3
      Re: How display Result from sqlCommand select in the Datagridview

      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:
      [color=blue]
      > Manfred,
      >
      > Yes, in fact the most simple a datatable.
      >
      > Use a sqldataadapter to fill that dataset
      >
      > Cor
      >
      > "Manfred" <mm1@USENEThsk. ch> schreef in bericht
      > news:uxiNbEmTGH A.4436@TK2MSFTN GP10.phx.gbl...[color=green]
      > > 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[/color]
      >
      >[/color]

      Comment

      • Cor Ligthert [MVP]

        #4
        Re: How display Result from sqlCommand select in the Datagridview

        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/lib...taadapter.aspx

        I hope this gives some ideas

        Cor


        "Manfred" <mm1@USENEThsk. ch> schreef in bericht
        news:%23sfpGTnT GHA.4384@tk2msf tngp13.phx.gbl. ..[color=blue]
        > 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:
        >[color=green]
        >> Manfred,
        >>
        >> Yes, in fact the most simple a datatable.
        >>
        >> Use a sqldataadapter to fill that dataset
        >>
        >> Cor
        >>
        >> "Manfred" <mm1@USENEThsk. ch> schreef in bericht
        >> news:uxiNbEmTGH A.4436@TK2MSFTN GP10.phx.gbl...[color=darkred]
        >> > 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[/color]
        >>
        >>[/color]
        >[/color]


        Comment

        Working...