storing BIT values using parameters
Posted: Sat 18 Mar 2006 12:11
I have declared a BIT field in on of MySQL tables and i want to store bit values there.
I am using C# and I am creating Parameters for other datatypes(varchar, int etc) however i don't think the bit is supported. I am defining the field Type using the MySqlType.
Code:
cmd.Parameters.Add("?IdType",MySqlType.Int);
cmd.Parameters["?IdType"].Direction = ParameterDirection.Input;
cmd.Parameters["?IdType"].Value = comp.IdType;
cmd.Parameters.Add("?Name",MySqlType.VarChar);
cmd.Parameters["?Name"].Direction = ParameterDirection.Input;
cmd.Parameters["?Name"].Value = comp.IdType;
cmd.CommandText ="INSERT Components (type_id, name, maxLoad, CurrentLoad, State) VALUES (?IdType, ?Name, ?MaxLoad, ?CurrentLoad, ) ";
State is ob Type Bit. Is there any way i could pass that value. Should I remove parameters and concatenate the values. I tried using parameters for better coding practices.
I am using C# and I am creating Parameters for other datatypes(varchar, int etc) however i don't think the bit is supported. I am defining the field Type using the MySqlType.
Code:
cmd.Parameters.Add("?IdType",MySqlType.Int);
cmd.Parameters["?IdType"].Direction = ParameterDirection.Input;
cmd.Parameters["?IdType"].Value = comp.IdType;
cmd.Parameters.Add("?Name",MySqlType.VarChar);
cmd.Parameters["?Name"].Direction = ParameterDirection.Input;
cmd.Parameters["?Name"].Value = comp.IdType;
cmd.CommandText ="INSERT Components (type_id, name, maxLoad, CurrentLoad, State) VALUES (?IdType, ?Name, ?MaxLoad, ?CurrentLoad, ) ";
State is ob Type Bit. Is there any way i could pass that value. Should I remove parameters and concatenate the values. I tried using parameters for better coding practices.