Multiple prepared insert statements fail
Posted by: Marcel Wijnands
Date: November 16, 2004 06:32AM

When I try to do multiple prepared insert statements, only the first one succeeds.

vb.net snippet:
---------------------------------------
Dim cmd As New MySqlCommand("DROP TABLE IF EXISTS Test", conn)
cmd.ExecuteNonQuery()
cmd.CommandText = "CREATE TABLE Test (fl FLOAT, db DOUBLE, dec1 DECIMAL(5,2))"
cmd.ExecuteNonQuery()

cmd = New MySqlCommand("INSERT INTO Test VALUES (?fl, ?db, ?dec)", conn)
cmd.Parameters.Add("?fl", MySqlDbType.Float)
cmd.Parameters.Add("?db", MySqlDbType.Double)
cmd.Parameters.Add("?dec", MySqlDbType.Decimal)
cmd.Parameters(0).Value = 2.3
cmd.Parameters(1).Value = 4.6
cmd.Parameters(2).Value = 23.82

cmd.Prepare()
cmd.ExecuteScalar()

cmd.Parameters(0).Value = 3.3
cmd.Parameters(1).Value = 2.6
cmd.Parameters(2).Value = 21.82

cmd.ExecuteScalar()
---------------------------------------

Results:
If the cmd.prepare statement is commented out, the table contains the expected 2 rows.
If the cmd.prepare statement stays as the snippet shows, the table contains only 1 row.

Is this a bug?

cheers,
Marcel

Options: ReplyQuote


Subject
Written By
Posted
Multiple prepared insert statements fail
November 16, 2004 06:32AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.