[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Solomon White

8/22/2002 9:46:00 PM

3 Answers

Solomon White

8/22/2002 10:25:00 PM

0

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


(Hussein Abuthuraya(MSFT))

8/24/2002 1:30:00 AM

0

Here are some things to look at:

- I'm not sure if the SCORE table name is a reserved word or not but looks like it may be. Try to wrap it around [].
- Check to see if the table has a primary key or not defined. Most likely not, so add one and try it again.


Thanks,
Hussein Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.co....


Solomon White

8/26/2002 6:26:00 PM

0

I tried enclosing the SCORE table in square brackets, but got the same
error. The RECORDID column is the primary key on the table. Any other
thoughts?


"Hussein Abuthuraya(MSFT)" <HussAbOnline@microsoft.com> wrote in message
news:25uf2zvSCHA.2084@cpmsftngxa10...
> Here are some things to look at:
>
> - I'm not sure if the SCORE table name is a reserved word or not but looks
like it may be. Try to wrap it around [].
> - Check to see if the table has a primary key or not defined. Most likely
not, so add one and try it again.