Hi all

I'm developing a VB.NET web application for our company, and have the requirement to work with some old dBase III files that are still used by our point-of-sale systems.

I've been able to successfully extract data from them for some time now without issue, but now there's a need to edit the records within some of the tables.

I've hooked the DBF directory into my application as a DataSource and can use a SqlDataSource control to pull the files into a gridview controls etc, however I can't seem to run any update queries against them.

From what I can gather its because I'm missing a primary key, but I don't quite know how to go about getting one in there. I wrote the following piece of code
Code:
Dim conStr As String = ConfigurationManager.ConnectionStrings("7Yunnan_DBF").ConnectionString
Dim conn As New System.Data.OleDb.OleDbConnection(conStr)

Dim sqlstr = "ALTER TABLE FoodType ADD CONSTRAINT Code PRIMARY KEY (Code)"

Dim dbfUpdate As New System.Data.OleDb.OleDbCommand(sqlstr, conn)

conn.Open()
dbfUpdate.ExecuteNonQuery()
conn.Close()
After running the above code, DBF Viewer seems to suggest that the index has been created, plus I have an .inf file showing the following, but its still no go.
Code:
[dbase]
MDX=FOODTYPE
UIDX=CODE
PRIMARY=CODE
Am I missing something? Or is CODE now a primary key, and I need to do something else entirely to execute an update query against it?