Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE DB Provider for Visual FoxPro
Message
From
26/11/2002 03:29:16
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
25/11/2002 15:10:19
Chad Ashpole
Ads Information Systems, Inc.
Minneapolis, Minnesota, United States
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
00726619
Message ID:
00726841
Views:
22
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform