By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,852 Members | 994 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,852 IT Pros & Developers. It's quick & easy.

"Operation Must Use An Updatable Query"?

P: n/a
I'm having a bit of trouble adding records to a local .DB file (using a
Paradox connection string). I checked the file permissions, and for
testing purposes set Everyone to Full access. But it seems that I can
add one and only one record to the table, any other attempts to insert
a record generate the error:

"Operation Must Use An Updatable Query"

I can access the table via other means, delete that one record, try
again, same results. Then I close out my application, leave the record
in the table, re-open the application and try again, and it gives the
same error before entering anything (since one and only one record is
already in the table).

Any idea what might be wrong?

Jun 2 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Sounds like a Paradox or database issue. Nothing to do with C#?
"cyber0ne" <cy*******@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
I'm having a bit of trouble adding records to a local .DB file (using a
Paradox connection string). I checked the file permissions, and for
testing purposes set Everyone to Full access. But it seems that I can
add one and only one record to the table, any other attempts to insert
a record generate the error:

"Operation Must Use An Updatable Query"

I can access the table via other means, delete that one record, try
again, same results. Then I close out my application, leave the record
in the table, re-open the application and try again, and it gives the
same error before entering anything (since one and only one record is
already in the table).

Any idea what might be wrong?

Jun 2 '06 #2

P: n/a
> Sounds like a Paradox or database issue. Nothing to do with C#?

Possible, but I'm at a loss on that route since other development
environments can access it just fine. I'm wondering if it's just
something in .NET itself that I'm overlooking.

My Delphi 7 apps have no problem, but anything in .NET (written in
Visual Studio or Delphi 2005) does.

Jun 2 '06 #3

P: n/a
Can you show some code which you are using to try and update the
database with?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"cyber0ne" <cy*******@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
I'm having a bit of trouble adding records to a local .DB file (using a
Paradox connection string). I checked the file permissions, and for
testing purposes set Everyone to Full access. But it seems that I can
add one and only one record to the table, any other attempts to insert
a record generate the error:

"Operation Must Use An Updatable Query"

I can access the table via other means, delete that one record, try
again, same results. Then I close out my application, leave the record
in the table, re-open the application and try again, and it gives the
same error before entering anything (since one and only one record is
already in the table).

Any idea what might be wrong?

Jun 2 '06 #4

P: n/a
> Can you show some code which you are using to try and update the
database with?


Sorry for any wrapping...

oleDBConnection = new
OleDb.OleDbConnection(@"Provider=Microsoft.Jet.OLE DB.4.0;Data
Source=h:\dev\data move .net\;Extended Properties=Paradox 5.x;");
oleDBCommandInsert = new OleDb.OleDbCommand();
oleDBCommandInsert.CommandText = "INSERT INTO TSTANKS (DF_FILENO,
A_LOCR_CD, DF_APPLY_DATE, DF_FIRST) VALUES (@integerDF_FILENO,
@stringA_LOCR_CD, @dateDF_APPLY_DATE, @stringDF_FIRST)";
oleDBCommandInsert.Connection = oleDBConnection;
.....{add the parameters, no need to show each of those lines here}....
oleDBConnection.Open();
oleDBCommandInsert.ExecuteNonQuery();
oleDBConnection.Close();

In practice, I'm actually looping through a DataSet and adding
parameters based on some logic from the data in the DataSet. So I open
the connection before the loop, each iteration clears the parameters
and re-adds them, executes, and then i close the connection after the
loop. But it always fails whenever i try to add a second record to the
table.

Jun 2 '06 #5

P: n/a

"cyber0ne" wrote
Sorry for any wrapping...
You're excused... ;-)
oleDBCommandInsert.CommandText = "INSERT INTO TSTANKS (DF_FILENO,
A_LOCR_CD, DF_APPLY_DATE, DF_FIRST) VALUES (@integerDF_FILENO,
@stringA_LOCR_CD, @dateDF_APPLY_DATE, @stringDF_FIRST)";


According to the documentation for OleDbParameters, the query should use ?
instead of named parameters in the query string.

You should still be able to use parameter names when creating the parameters
as such.

Have you tried it?

oleDBCommandInsert.CommandText =
"INSERT INTO TSTANKS " +
"(DF_FILENO, A_LOCR_CD, DF_APPLY_DATE, DF_FIRST) " +
"VALUES (?, ?, ?, ?)";

/// Bjorn A
Jun 2 '06 #6

P: n/a
> oleDBCommandInsert.CommandText =
"INSERT INTO TSTANKS " +
"(DF_FILENO, A_LOCR_CD, DF_APPLY_DATE, DF_FIRST) " +
"VALUES (?, ?, ?, ?)";


Hadn't seen that before, but no change in behavior.

Jun 2 '06 #7

P: n/a
cyberOne,
This particularly cryptic exception message often occurs with file-based
databases(such as MS Access) when the account under which the code is running
does not have write permissions to the folder/database file.
Try right-clicking the db folder, choose Properties, then Sucurity Tab and
either give Everyone "Full Control" or the specific acount (which may need to
be added).

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"cyber0ne" wrote:
I'm having a bit of trouble adding records to a local .DB file (using a
Paradox connection string). I checked the file permissions, and for
testing purposes set Everyone to Full access. But it seems that I can
add one and only one record to the table, any other attempts to insert
a record generate the error:

"Operation Must Use An Updatable Query"

I can access the table via other means, delete that one record, try
again, same results. Then I close out my application, leave the record
in the table, re-open the application and try again, and it gives the
same error before entering anything (since one and only one record is
already in the table).

Any idea what might be wrong?

Jun 2 '06 #8

P: n/a
> This particularly cryptic exception message often occurs with file-based
databases(such as MS Access) when the account under which the code is running
does not have write permissions to the folder/database file.
Try right-clicking the db folder, choose Properties, then Sucurity Tab and
either give Everyone "Full Control" or the specific acount (which may need to
be added).


"Everyone" has "Full Control" on the folder in question and all files
contained therein. No change in behavior.

Jun 2 '06 #9

P: n/a
Do you have a primary or unique key defined ?

"cyber0ne" <cy*******@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
I'm having a bit of trouble adding records to a local .DB file (using a
Paradox connection string). I checked the file permissions, and for
testing purposes set Everyone to Full access. But it seems that I can
add one and only one record to the table, any other attempts to insert
a record generate the error:

"Operation Must Use An Updatable Query"

I can access the table via other means, delete that one record, try
again, same results. Then I close out my application, leave the record
in the table, re-open the application and try again, and it gives the
same error before entering anything (since one and only one record is
already in the table).

Any idea what might be wrong?

Jun 2 '06 #10

P: n/a
> Do you have a primary or unique key defined ?

Either my SQL Explorer program doesn't fully understand the Paradox
file's key structure, or there is no key defined. The DB2 table from
which this Paradox file was generated had a primary key defined, and
that field in this case is definitely unique for the records I'm adding.

Jun 5 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.