DataGridView with ODBC

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
 
P

Philip Hristov

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.
 
M

Mark Rae

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top