Solomon White
8/22/2002 10:25:00 PM
I tried replacing the DataAdapter.Update with a foreach loop that looks at
every row in the DataTable with a DataRowState of Modified, generates an
update SQL string, builds an OdbcCommand with that CommandText, and calles
ExecuteNonQuery() on that OdbcCommand. This gives me the following error:
ERROR [HY000] [Microsoft][ODBC Paradox Driver] Operation must use an
updateable query.
Here's the foreach loop...
foreach (MyDataSet.SourceDataRow oRow in _DS.SourceData.Rows) {
if (oRow.RowState == System.Data.DataRowState.Modified) {
string sSQL = "UPDATE SCORE SET [UPDATE] = '1' WHERE RECORDID = " +
oRow.RECORDID;
OdbcCommand MyOdbcCommand = new OdbcCommand();
MyOdbcCommand .CommandText = sSQL;
MyOdbcCommand .Connection = MyOdbcConnection;
MyOdbcConnection.Open();
MyOdbcCommand .ExecuteNonQuery();
MyOdbcConnection.Close();
}
}
So scratch that as a possible workaround...
----------------------------------------------------------------------------
-------------------------
"Solomon White" <solomon_white@amr-corp.com> wrote in message
news:#1FovRhSCHA.1496@tkmsftngp11...
Hello all--
I am writing a .NET application to transfer data from multiple Paradox DB
sources to a SQL server for consolidated reporting. After transferring a
record, I want to update a flag column so that I can transfer only unflagged
(new) records from the file.
I am using Microsoft.Data.Odbc classes to read data from the Paradox DB into
.NET DataSet. The transfer from Paradox to SQL is working fine, but when I
try to call the Update() function on the Paradox DataAdapter, I get this
error message:
ERROR [07002] [Microsoft][ODBC Paradox Driver] Too few parameters. Expected
2.
My suspicion is that it has something to do with the SQL syntax specific to
Paradox, which I don't know. Here's the code that sets up the DataAdapter:
cmdUpdate.CommandText = "UPDATE SCORE SET [UPDATE] = @UPDATE WHERE (RECORDID
= @RECORDID)";
cmdUpdate.Parameters.Add(new Microsoft.Data.Odbc.OdbcParameter("@UPDATE",
Microsoft.Data.Odbc.OdbcType.NVarChar, 1, "UPDATE"));
cmdUpdate.Parameters.Add(new Microsoft.Data.Odbc.OdbcParameter("@RECORDID",
Microsoft.Data.Odbc.OdbcType.NVarChar, 10, "RECORDID"));
(I didn't name the column, so don't blame me) Any ideas?
Thanks in advance,
Solomon