Implementing ODBC in ASP .NET

Making it work

Ultimately, the solution to this problem is for some enterprising developer to pick up the reins and finish what Microsoft started by writing a set of fully functional ODBC server controls. In the meantime, however, it turned out to be relatively straightforward to examine the code generated by the OLE DB server controls and adapt it to the ODBC object set.

The remainder of this article walks the reader through one such solution. The subject is HotQuant’s News & Updates page. With respect to the database, the page's requirements are simple:

  • It must be able to locate a single record in the database based on an e-mail address, which is the table's primary key.
  • If it can locate a record, it must modify it.
  • If it can't locate a record, it must insert a new one.

The reader will note that, although the functionality described above requires SQL Select, Insert, and Update commands, only the Select command is defined in the code below. This is possible because an OdbcCommandBuilder object, once associated with a particular ODBC Data Adapter, automatically generates appropriate Insert, Update, and Delete commands when prompted by corresponding calls to the Data Adapter's associated Dataset.

Since the primary focus of this article is the ODBC connectivity issue, we have abridged the code presented below in order to highlight that functionality.

You might also like...

Comments

About the author

Jason G. Williscroft

Jason G. Williscroft United States

Jason Williscroft is a former Marine and naval officer, and a graduate of the United States Naval Academy, where he studied Systems Engineering. He is currently General Manager of HotQuant, LLC,...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity.” - Dennis Ritchie