Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert generates NULL error
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Title:
Insert generates NULL error
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01174759
Message ID:
01174759
Views:
53
Hey all,

I have another .NET issue. I built a DBFUtil object that initializes the SelectCommand, InsertCommand, UpdateCommand, and DeleteCommand objects in a DataAdapter to all use the same VFPOLEDB connection. Everything works fine, and I can SELECT, INSER, UPDATE, and DELETE using a DataTable hooked to a DataGridView.

But when I try to add a new record by entering a new row in the grid, I get NULL errors unless I fill in every field that is being added. There are no constraints on the DBF (it is a free table), and I know new rows are inserted properly if I fill everything in.

I had the same issue with straight SELECT statements, and got around it by issuing a "SET NULL OFF" in the SelectCommand object using ExecuteNonQuery(). For SELECTs, I can have NULLs all over (e.g. when running LEFT JOINS), but if I run the same SET NULL OFF for InsertCommand and UpdateCommand as well, I am still getting NULL errors from the OleDb provider when adding or updating records involving NULLs.

Obviously, I can get around this by making sure I don't have NULLs involved. *smile* But I was wondering if there was another way? Frankly, sometimes NULLs are very useful, as in having a logical field that can be true, false, or simply unanswered. I need to get NULLs working if I can, for creates, reads, updates, and deletes...

Thanks,
JoeK
Next
Reply
Map
View

Click here to load this message in the networking platform