OdbcParameter - fail database update
6/16/2009 1:01:00 PM
I have created an ODBCDataAdapter and then created a UpdateCommand using the
sql statement "update tab_author set auth_id = ? where auth_num = ?"
For the updatecommand I have created 2 new paramaters
adapter.UpdateCommand.Parameters.Add("@auth_id", OdbcType.Char, 3, "auth_id");
and then
OdbcParameter param = new OdbcParameter();
param.DbType = DbType.Int32;
param.Size = 10;
param.ParameterName = "@auth_num";
param.SourceVersion = DataRowVersion.Original;
param.SourceColumn = "auth_num";
adapter.UpdateCommand.Parameters.Add(param);
This paramater refers to a serial key in a database. When I do an update I
get the following error message "Invalid string or buffer length". If I
don't include the serial paramater and instead hard code the serial into the
sql statement, the update works.
I can't do this because I believe that the DBConcurrencyException error will
not be thrown when doing updates if I don't have the serial field as a
paramater..
So how do I created a OdbcParameter that refers to a serial key in a database.