Using VB.Net to insert rows into a FoxPro table
Posted on 2005-04-19
I'm writing an application that needs to amend some FoxPro tables. So far, I can conenct to the database and view data no problems, but I get stuck when trying to use the INSERT command.
Here's what I have so far:
Dim AquaCmd As New OleDbCommand
Dim AquaTrans As OleDbTransaction
AquaTrans = cnAqua.BeginTransaction
AquaCmd.Connection = cnAqua
AquaCmd.Transaction = AquaTrans
AquaCmd.CommandText = "INSERT INTO cseadd (cadsid, csekey, txt1) VALUES ('19000', '21000', '001')"
The cseadd table is present, and the values 19000, 21000 and 001 are hard coded into the code so I don't have variables in things to begin with. I've tried it with the apostrophes in the VALUES section, without, and anything else I can come up with, still no joy.
This always fails at the ExecuteNonQuery() part, saying I get an "unhandled exception error"
Does anyone have any idea as to where I might be going wrong here?