1

Q:

I get the following exception when i try to execute the following query:

INSERT INTO days  (depcode,studycode,batchnum) values (3,3,4);SELECT DBINFO( 'sqlca.sqlerrd1' )
FROM systables
WHERE tabid = 1;

Through ExecuteScalar() .

ERROR:-555 MEssage: [Informix .NET provider][Informix]Cannot use a select or any of the database statements in a multi-query prepare.

Anyname Donotcare
  • 11,113
  • 66
  • 219
  • 392

1 Answers1

2

The statement text that is presented with this PREPARE statement has multiple statements divided by semicolons, and one is a SELECT, DATABASE, CREATE DATABASE, or CLOSE DATABASE statement. These statements must always be prepared as one-statement texts. Check the statement text string, and make sure that you intended multiple statements. If you did, revise the program to execute these four statement types alone.

Means, try to do the insert and the select in two separate query's.

Destructor
  • 1,641
  • 1
  • 13
  • 13
  • hmmm, i wanna then in the same statement. – Anyname Donotcare Jul 27 '11 at 12:09
  • 2
    Why do you want them in the same statement? – Frank Schmitt Jul 27 '11 at 12:11
  • because i will insert large number of records (without transation) and i will store all the returned ids from the previous query in a list or array . so if any failure has happened , i will use this list to delete all the inserted records. – Anyname Donotcare Jul 27 '11 at 12:26
  • 1
    First i don´t know why you will do s.th. like this without transactions. and second: why isn´t that possible by using two statements ? – Destructor Jul 27 '11 at 12:33
  • No transaction because the number of records is huge and the number of users will be many. so i don't want lock on this table, in addition to the following problem: http://stackoverflow.com/q/6483363/418343..no two statements because i wanna to be executed at the same time. – Anyname Donotcare Jul 27 '11 at 12:49