ODBC & .NET TableAdapters
When using an ODBC connection the table adapters will not allow you to add variables. you cannot use the @var syntax as with SQL Server. The only syntax available is the same when using variables to a MS Access DB. You must use ‘?’ where a variable will go eg.
SELECT * FROM ? where dog = ‘?’
The variables are used in the order that you add them to the query. This makes TableAdapters quite restricted and to me, useless… if they already weren’t too clunky.
You should use a good old sql query in the page, or create your own DAL as a class.
A simple ODBC query can be made using a simple function similar to:
using System.Data.Odbc; public OdbcDataReader query(string queryString) { OdbcCommand command = new OdbcCommand(queryString, connection); OdbcDataReader result = command.ExecuteReader(); return result; }
The Returned result can then be bound to a Repeater, DataGrid, etc