1
Reply

inserting blob in database -->get error : column 'x' can not be null

Maria.Albuerne.Gonzalez

Maria.Albuerne.Gonzalez

Aug 18 2004 5:35 AM
2.1k
I am trying to insert data in a column of type blob ( MySQL-ODBC 3.51 Driver ); I use a parametrized sql command with following sintax: string sql ="INSERT INTO Mytable(....,MyColumn) VALUES(.....,@MyParameter)"; .... and afterwards: OdbcParameter p=cmd.Parameters.Add"@MyParameter",OdbcType.VarBinary,bytes.Length,"MyColumn"); p.Value=bytes; cmd.CommandType = CommandType.Text; cmd.CommandText=sql; cmd.ExecuteNonQuery(); My Problem is that I keep getting the following exception System.Data.Odbc.OdbcException: ERROR [HY000] [MySQL][ODBC 3.51 Driver][mysqld-4.0.18-nt]Column 'MyColumn' cannot be null Kan anybody say what I am doing wrong`? Thanx in advance

Answers (1)