Selecting data from the DB while inside a transaction
returns:
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an
object.
Source: ByteFX.Data
at
ByteFX.Data.MySqlClient.MySqlDataReader.GetValue(Int32
i) in
Z:\workingcopy\mysqldriver\MySqlClient\datareader.cs:line
35
at
ByteFX.Data.MySqlClient.MySqlDataReader.GetInt32(Int32
i) in
Z:\workingcopy\mysqldriver\MySqlClient\datareader.cs:line
476
at .... (my code)
The problems seems to originate in the
MySqlClient/Driver.cs class in 'ReadPacket()' where the
packet type is returned as UpdateOrOk, which causes
problems around line 152 of MySqlClient/datareader.cs
Logged In: YES
user_id=523261
Do you have a code snippet you can send me that shows the
problem?
Thanks
Reggie
Logged In: NO
Using MySql for windows version 4.0.13-nt on WinXP pro,
ByteFx driver version 0.7.0.34801, the following code breaks
with the given SQL.
--
-- SQL
--
CREATE TABLE account (
id INTEGER PRIMARY KEY,
balance INTEGER NOT NULL
);
INSERT INTO account VALUES(1, 100);
using System;
using ByteFX.Data.MySqlClient;
namespace MySqlTest
{
class Test1
{
public Test1()
{
int id = 1;
int extra = 200;
id=root;database=test";
MySqlConnection connection = new
MySqlConnection(connectionString);
connection.Open();
MySqlDbType.Int24, "id");
idParam.Value = id;
transaction);
cmd.Parameters.Add(idParam);
MySqlDataReader reader = cmd.ExecuteReader();
MySqlParameter("@balance", MySqlDbType.Int24, "balance");
balanceParam.Value = balance + extra;
idParam.Value = id;
@id";
cmd = new MySqlCommand(sql, connection, transaction);
cmd.Parameters.Add(idParam);
cmd.Parameters.Add(balanceParam);
}