>I have a little bit of a problem. I am creating a web service using .NET. One of my functions inserts a new record into a FoxPro table. I have a connection string that uses the OLE DB Provider for Visual FoxPro and I am connecting using ADO.NET. When I run my function to insert a new record into my table, I have to specify all fields or I get an error that states somefield in my table does not accept null values. So my first question is, is there a some way that I do not have to include all fields in my insert statement? I cannot set the fields to accept nulls, so that is not an option. If there is no way to do this that's fine, I can specify all of my fields in the insert and add default values, but that leads me to my next question. There is a general field in the table. Is there a default value I can use in the insert statement for a general field? The only thing I can think of is APPEND GENERAL but that isn't an option in this case. The ideal solution would be to find
>some way where the OLE DB Provider did not insert nulls if I do not include all of the fields in my insert statement. However, I'm not sure if that is possible.
Chad,
You're right by default VFPOLEDB driver tries to insert NULLs for not specified fields instead of blank values unlike native insert (SET NULL : Native default OFF, OLEDB ON).
However VFPOLEDB driver supports 'set null on/off' command. ie :
LOCAL oConnection as 'ADODB.connection'
oConnection = NewObject("adodb.connection")
With oConnection
.ConnectionString = ;
'Provider=VFPOLEDB.1;Data source=c:\myPath\testdata.dbc;'
.Open
.Execute("set null off")
.Execute("insert into customer (cust_id) values ('dummy')")
ENDWITH
Cetin