J
john coltrane
I am trying to use parameters with mysql and I am not getting any
results returned.
In the following example the "legs" column is defined as INTEGER.
For a simple test I am using the following snippet:
MySqlConnection conn;
conn = new MySqlConnection(connStr);
conn.Open();
statement = "select * from limbs where legs = @legs";
MySqlCommand command = new MySqlCommand(statement, conn);
MySqlParameter param = new MySqlParameter();
param.ParameterName = "@legs";
param.Value = 2;
param.MySqlDbType = MySqlDbType.Int32;
command.Parameters.Add(param);
MySqlDataReader reader;
reader = command.ExecuteReader();
while ( reader.Read() ) {
Console.WriteLine("{0}|{1}|{2}|", reader[ "thing" ],
reader[ "legs" ], reader[ "arms" ]);
}
reader.Close();
} catch ( MySqlException mysql_e ) {
Console.WriteLine(mysql_e.Message);
}
No results are returned and no error is generated.
I am using MySql 5.1 with MySql Connect Net 1.0.7 and .Net Framework
3.0.
thanks for any help
results returned.
In the following example the "legs" column is defined as INTEGER.
For a simple test I am using the following snippet:
MySqlConnection conn;
conn = new MySqlConnection(connStr);
conn.Open();
statement = "select * from limbs where legs = @legs";
MySqlCommand command = new MySqlCommand(statement, conn);
MySqlParameter param = new MySqlParameter();
param.ParameterName = "@legs";
param.Value = 2;
param.MySqlDbType = MySqlDbType.Int32;
command.Parameters.Add(param);
MySqlDataReader reader;
reader = command.ExecuteReader();
while ( reader.Read() ) {
Console.WriteLine("{0}|{1}|{2}|", reader[ "thing" ],
reader[ "legs" ], reader[ "arms" ]);
}
reader.Close();
} catch ( MySqlException mysql_e ) {
Console.WriteLine(mysql_e.Message);
}
No results are returned and no error is generated.
I am using MySql 5.1 with MySql Connect Net 1.0.7 and .Net Framework
3.0.
thanks for any help