Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE DB Provider for Visual FoxPro
Message
From
26/11/2002 12:38:02
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
26/11/2002 12:32:28
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:
00727130
Views:
22
This message has been marked as the solution to the initial question of the thread.
>I did some digging around and found a sample of C# code where they were passing SET NULL OFF. However, I can't seem to get it to work using VB.NET. I pass in the SET NULL OFF command and issue a ExecuteNonQuery() on that command. I then pass in my insert command and issue an ExecuteNonQuery() but I still get the error (field name XXX does not accept null values). Do you have any samples of this code using VB.NET?

Sorry I don't deal with VB. I think it'd be easy for you to convert :
using System;
using System.Data;
using System.Data.OleDb;

namespace ConsoleApplication1
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
                        string strConn = 
             "Provider=VFPOLEDB.1;Data source=c:\\myPath\\testdata.dbc;";
			OleDbConnection cn = new OleDbConnection(strConn);
			cn.Open();
			OleDbCommand cmd = cn.CreateCommand();
			cmd.CommandText = "set null off";
			cmd.ExecuteNonQuery();
	cmd.CommandText = "insert into customer (cust_id) values ('dum1')";
			cmd.ExecuteNonQuery();
	cmd.CommandText = "insert into customer (cust_id) values ('dum2')";
			cmd.ExecuteNonQuery();
		}
	}
}
It's tested and works.
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