Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Insert generates NULL error
Message
De
04/12/2006 19:23:54
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01174759
Message ID:
01174807
Vues:
9
Joe,

Can you have your DBFUtil class ignore columns that contain NULL? IOW, have your class generate an Insert that simply ignores those NULL columns.

~~Bonnie



>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
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform