DataGridView with ODBC

  • Thread starter Thread starter 1qa2ws
  • Start date Start date
1

1qa2ws

Hi,

I really don't know how to use DataGridView with ODBC connection. I have an
DSN ODBC connection and I know how to connect to it. I can query the
database. I'd like to get the query result into the DataGridView table and I
don't know how. Can anybody help me? Thanks

1qa2ws
 
You mean DataGrid? First you have to setup OleDbConnection (its
connection screen), OleDBAdapter and a DataSet. Check Microsoft .NET
SDK 1.1 Documentation for more information.

Philip.
 
I really don't know how to use DataGridView with ODBC connection. I have
an DSN ODBC connection and I know how to connect to it. I can query the
database. I'd like to get the query result into the DataGridView table and
I don't know how. Can anybody help me? Thanks

1) Connect to your ODBC datasource

2) Return a recordset from your ODBC datasource into an OdbcDataReader
object

3) Set the DataGrid's DataSource property to the OdbcDataReader object

4) Call the DataGrid's DataBind() method
 
Back
Top