How many ways can we connect to database(database connection, data adapter, dataset)? Also, you could give me a sample how to display data (from SQL2000 server) to a datagrid?  I'm a newbie .
Who is Participating?
Brian CroweDatabase AdministratorCommented:
dataadapter and datareader are the typical ways.

private ds as new dataset
private da as new sqldataadapter
private sub load(...) handles mybase.load
   myDataGrid.datasource = ds.tables("Data")
end sub

private sub DefineAdapter()
   with da
      .selectcommand = new sqlcommand
      with .selectcommand
         .connection = new sqlconnection({connection string})
         .commandtext = "SELECT col1, col2, col3 FROM myTable"
      end with
      'optionally add insertcommand/updatecommand/deletecommand if you want to update your database from the app

      .acceptchangesduringfill = true
      .tablemappings.add("Table", "Data")
   end with
end sub
VBdotnet2005Author Commented:
Is this vb6?
Brian CroweDatabase AdministratorCommented:  You did post this question in a VB.Net Topic Area :-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.