473,387 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Table 'x' was not locked with LOCK TABLES

Hi,

I am facing a strange problem with this code.

Expand|Select|Wrap|Line Numbers
  1. command.CommandText = PmdConstStrings.GetSqlStatement(PmdSqlStatements.GetMaxVerificationIndex);
  2. return (int)command.ExecuteScalar();
  3.  
where CommandText get the value 'SELECT indexValue FROM Indexes;\nUPDATE Indexes set indexValue = indexValue + 1'

Like you can see I send this query to the DB and I expect and int value but an exception occurs.

If I type the Query manually in SQLyog it shows the value and it's also increased

+-------------+
| indexValue |
+-------------+
| 3 |
+-------------+


with ExecuteScalar it takes the first column of the first row, should I add something else to the line to take the value 3 from the column?

What do you think? with this exception happend?

By the way I have already restart the computer several times and this keep happening.

Best Regards,
Raul
Jun 8 '09 #1
1 2082
r035198x
13,262 8TB
The SELECT returns a value and so does the UPDATE. Which result are you expecting, the select one or the update one?
Split the statements and pass them separately.
Jun 8 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Johannes B. Ullrich | last post by:
--=-WKgoK98ejo9BZyGYc3N/ Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I am having problems with MySQL 4.0.12 on RedHat Advanced Server 2.1 using a dual Xeon with 8...
3
by: rkusenet | last post by:
I have written a stored procedure to list out all tables in which rows or the table itself is locked. The only information I am not able to get is the time when the lock occurred. The way I want...
0
by: CaptainMcBunnyTickle | last post by:
Using FLUSH TABLES via the C query API mysql_query() hangs if the table is locked already. That is to say, nothing prevents me from running a LOCK TABLES twice; it won't tell me "it's already...
1
by: Mel Apiso | last post by:
Hi, I want to know if I can detect exactly what row table is locked. My application is locked and I get valuable information (table, application, lock mode...) with "get snapshot for locks..."...
1
by: deko | last post by:
Is there a way to unlock a table so a subroutine can complete? frmMain!frm0 has got a lock on a table I need to do stuff with. Error Number 3211: The database engine could not lock table...
4
by: Nestor | last post by:
I'm writing a simple aspx page that allows users to key in some data and submit them into a SQL2k database. I realised that even after that db connection closes and the page unloaded and closed,...
2
by: adri4n | last post by:
as wat ive mentioned in the title.. im would like to know whether the a particular record/table is being locked in my program. some of the methods which i would like to develop are as below: ...
22
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4....
0
by: shakahshakah | last post by:
Just started investigating InnoDB after having used MyISAM tables in the 4.0.12 version, almost immediately ran into a locking issue with INSERTs, DELETEs, and transactions. Given the following...
7
dlite922
by: dlite922 | last post by:
I need to do some sort of Locking mechanism at interface level, instead of DB Level. I know how MySQL table locking works, but that won't work in my scenerio. Requirements: When someone is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.