Multiple prepared insert statements fail
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
Subject
Written By
Posted
Multiple prepared insert statements fail
November 16, 2004 06:32AM
November 16, 2004 08:25AM
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.