Bug in OdbcCommandBuilder

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: ehmy (volcanoinsilence_at_hotmail.com)
Date: 07/25/04


Date: Sun, 25 Jul 2004 21:49:59 +0800

Hello.

I find OdbcCommandBuilder can not work properly when prepare command for
Sybase ASE Server 12.0.

I need to access Sybase ASE Server 12.0, but Oledb provider provided by
Sybase can not work, so I have to use ODBC.
The table "user" need to be updated has two field: companyid (int, primary
key), name (nvarchar). I use these code to auto bulid commanders:
   OdbcDataAdapter DataAdapter = new OdbcDataAdapter("select companyid ,name
from user ',Connection);
   OdbcCommandBuilder CommandBuilder= new OdbcCommandBuilder(DataAdapter);
   DataAdapter.InsertCommand= CommandBuilder.GetInsertCommand();
   DataAdapter.UpdateCommand= CommandBuilder.GetUpdateCommand();
   DataAdapter.DeleteCommand= CommandBuilder.GetDeleteCommand();

unfortunately, the command text built is:
 DELETE FROM clients WHERE ( (companyid = ?) )
 INSERT INTO clients( companyid ) VALUES ( ? )
 UPDATE clients SET companyid = ? WHERE ( (companyid = ?) )

field name has lost in all these command text. I find in fact these
commander all has two Parameters in System.Data.Odbc.OdbcParameterCollection
when debuging.

In ODBC .NET Data Provider download page
(http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=6cc
d8427-1017-4f33-a062-d165078e32b1 ), microsoft mentioned as follows:
The ODBC .NET Data Provider is intended to work with all compliant ODBC
drivers but only the following drivers have been tested with the ODBC .NET
Data Provider:
  a.. Microsoft SQL ODBC Driver
  b.. Microsoft ODBC Driver for Oracle
  c.. Microsoft Jet ODBC Driver
 The final ODBC .NET Data Provider is released in 1/30/2002.

Sybase ASE Server 12.5 Client has a new Oledb provider which can work. But
the server's charset is gp850 (has some two byte chars in data), and the
client can not auto translate charset, so no-ASCII code can not display
properly.

Maybe I do something wrong. Should I code my CommandBuilder?

Thanks for your help.

ehmy



Relevant Pages