I am running into a few problems trying to insert records into a Visual FoxPro data file using Navision code, and I’m wondering if any of you can offer some suggestions. I know that I can solve this problem externally, through VB, C++, etc. Since that would add an undesired layer of maintenance and support to the project, and primarily because it would offend my sense of order, I prefer to focus on accomplishing the task from within Navision for now. I’ve read all the posts I can find on the ADO/DAO/OCX subjects, and have had no trouble writing to dBase files using ADO 2.6 with ODBC DSNs configured with the ODBCJCT32 (MS dBase Driver). The trouble starts when I apply the same program code to a different DSN based on the VFPODBC drivers. I can read without any problems, but my Insert instruction returns an error - ‘[Microsoft][ODBC Visual FoxPro Driver]Field fieldname does not accept null values.’ Has anyone run into this, and perhaps resolved it? All my ADO controls and ODBC drivers are current. I’ve been tinkering with it for the past few days and have not found a solution. I does look like there might be some options - VFP ole db, FoxServer COM 6.0 & FoxServer OLE 5.0 automation controls, DAO, etc. I’d just like some input before I start down that road. I wrote my code following Jon McArthur’s Feb 14 2003 post (thanks Jon), so it looks pretty much like his. I’ll be happy to post it though if you think it will help. Thanks for any thoughts on the subject.
your error shows that you are trying to save a null(blank) value in the field which constraint has been set as not null or the field is in primary key.
Thanks ajay, your response helped me focus. I had been looking intently at the connection strings in c/side, and at the file type on the data side, but had overlooked the ODBC driver settings. Looks like unchecking the Null checkbox on the Visual FoxPro ODBC driver should do the trick.