Hello,

I am trying to execute an sql insert command and I am getting an exception
stating that a table field does not accept null values. While I do not
provide a value for the field in the command, there is a default value
defined for that column in the db. I have tried the exact same command
directly in FoxPro and it works fine. Does anyone have any ideas as to why
the provider is trying to insert a null value behind the scenes?

I am working with Visual Studio .NET 2003, C#, Visual Foxpro 7.0 SP1. A code
snippet and the exception message are below.

Thanks

Bill

string cmdText = "INSERT INTO table1 (name, parametervalue ) VALUES ('test',
'test')"
OleDbCommand cmd = new OleDbCommand( conn, cmdText );
conn.Open()
cmd.ExecuteNonQuery();

System.Data.OleDb.OleDbException: Field IROW does not accept null values.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at DataAccess.ParametersDAC.AddRecord(DataRow record) in
e:\dataaccess\parametersdac.cs:line 286