public void CanInsertNullStringParameter()
using (DbConnection connection = db.CreateConnection())
using (DbTransaction transaction = connection.BeginTransaction())
string sqlString = "insert into TempCustomers (CustomerID, CompanyName, ContactName) Values (?, ?, ?);"
DbCommand insert = db.GetSqlStringCommand(sqlString);
db.AddInParameter(insert, "CustomerID", DbType.Int32, 1);
db.AddInParameter(insert, "CompanyName", DbType.String, "test");
db.AddInParameter(insert, "ContactName", DbType.String, null);
CREATE TABLE TempCustomers (CustomerId VARCHAR(5) NOT NULL, CompanyName VARCHAR(128) NOT NULL, ContactName VARCHAR(128) NULL);
insert into TempCustomers (CustomerID, CompanyName, ContactName) Values (?, ?, ?)
Check TdCommand.Parameters.IsNullable property. I think isNullable is set to false but the application is sending a DbNull to the Teradata Database; resulting in a mismatch between the parameter description (NOT NULABLE) and the parameter value (NULL).
Yes, that appears to be it - the test case works when I change IsNullable to true. Thanks for the guidance.