DataGridView & ODBC

Hi all,

I often use DataGridView component to manage data in the database. It's very flexible, can copy to clipboard, allow run-time column-sorting and so on.

When I want to manage an access database - there's no problem, I add a new datasource to project, which is connected via OleDb to .mdb file, set up the DataGridView's datasource property to DataSet ...

But what if I need to bind the DataGridView to a table, which I've on SQL-server at work I tried to use an ODBC access, but it's unknown for a project datasource.

Any idea how DGV can work through ODBC

PS: I don't want the DataSet to connect directly to SQL-server's .mdf file! It isn't solution!

Thanx so far...



Answer this question

DataGridView & ODBC

  • James V

    Make sure you have added a reference to System.Data.Odbc to your project references. You might also consider using the built in Sql provider, in the System.Data.Sql namespace.

  • iscbaltazar

    In my project references I have System.Data reference and in "Imported namespaces" I have System.Data.Odbc checked.

    But nothing changed, I can't bind my DGV via ODBC.


  • DataGridView & ODBC