Hi Dave,
Your sample code looks a bit familiar ... I frequently use "select * from bob" in my examples. You've also left SqlCommand when you meant to use OleDbCommand. But, nevermind .... <g>
I haven't messed with fox data lately in .NET, but are you sure the tables needs a primary key? That may only be if you're using things like the command builder perhaps?
~~Bonnie
>it can be done, however, you need to have a primary key field in each foxpro 2.x table that you'd like to update.
>
>make sure all the free Fox 2.x tables are in c:\mydatadirectory\
>
>
>public void UpdateMyData(DataSet ds)
>{
> // I wouldn't actually hard-code the connection string here, it should be in your config settings
> string TestConnection =
>"Provider=vfpoledb.1;Data Source=C:\MyDataDirectory\;Collating Sequence=general";
>
> SqlCommand sc = new SqlCommand();
> sc.Connection = new SqlConnection(TestConnection);
> sc.Connection.Open();
> foreach (DataRow Row in ds.Tables[0].Rows)
> {
> switch (Row.RowState)
> {
> case DataRowState.Added :
> sc.CommandText = "Insert into bob (xyz, abc) VALUES ( @xyz, @abc )";
> sc.Parameters.Clear();
> sc.Parameters.Add("@xyz", Row["xyz"]);
> sc.Parameters.Add("@abc", Row["abc"]);
> sc.ExecuteNonQuery();
> break;
>
> // Do the same for DataRowState Deleted and Modified
> case DataRowState.Deleted :
> break;
> case DataRowState.Modified :
> break;
> }
> }
> sc.Connection.Close();
>}