Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating a VFP DB from another language
Message
 
 
To
27/06/2003 18:08:06
Mark Highfield
Nitevision Software
London, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00804927
Message ID:
00804935
Views:
32
>I am writing a C# app that connects to a foxpro DB. I can get a connection, as well as read data, but for some reason, no matter what I try, I get the error 'Cannot update the cursor' when trying to write to the DB. I have tried adding 'Mode=ReadWrite' to the connection string, as well as several other things. Can somebody please tell me why I can't write to the database?
>
>Thanks


I think this works in VS.Net 1.0 with the vfpoledb provider, but there is probably a better way by now. Been awhile since I've worked with this.
string vfpSqlUpdate = "";
OleDbConnection myConn = new OleDbConnection();
myConn.ConnectionString = "Provider=vfpoledb;Data Source=C:\\my.dbc";
			
// query string to push through the vfpoledb provider
vfpSqlUpdate = "update mytable set myfield = + " + myValue.ToString();

// create the command, assign it the string created above
OleDbCommand vfpUpdateCommand = new OleDbCommand( vfpSqlUpdate, myConn);

//open the connection
myConn.Open();

// execute the update
vfpUpdateCommand.ExecuteNonQuery();

//close the connection
myConn.Close();
Previous
Reply
Map
View

Click here to load this message in the networking platform