Hello All,
Please help me to resolve this error( Invalid precision value ) which I am getting from C # application when i am trying to insert IMAGES( BINARY FORMAT ) to the database( DB = MS Access ).
here is my code
private void btnSaveToDB_Click(object sender, EventArgs e)
{
OdbcConnection odbcConnection = null;
OdbcCommand odbcCommand = null;
try
{
odbcConnection = new OdbcConnection(@"Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\\TestFP.mdb;Uid=;Pwd=;");
odbcConnection.Open();
odbcCommand = odbcConnection.CreateCommand();
odbcCommand.CommandText = "INSERT INTO Employee ( Name ,FingerImage_1 ) VALUES (?,?)";
System.Data.Odbc.OdbcParameter nameFiled = new System.Data.Odbc.OdbcParameter();
nameFiled.OdbcType = System.Data.Odbc.OdbcType.Text;
nameFiled.ParameterName = @"Name";
nameFiled.Value = @"My Name";
odbcCommand.Parameters.Add(nameFiled);
System.Data.Odbc.OdbcParameter imageField_1 = new System.Data.Odbc.OdbcParameter();
imageField_1.OdbcType = System.Data.Odbc.OdbcType.Binary;
imageField_1.ParameterName = @"FingerImage_1";
imageField_1.Value = _mainDialog._imageStream_1.ToArray();
odbcCommand.Parameters.Add(imageField_1);
int rows_affected = odbcCommand.ExecuteNonQuery(); //RUN TIME ERROR = System.Data.Odbc.OdbcException: ERROR [HY104] [Microsoft][ODBC Microsoft Access Driver]Invalid precision value
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
odbcConnection.Close();
}
}
|
HERE is the Run Time Error ...
System.Data.Odbc.OdbcException: ERROR [HY104] [Microsoft][ODBC Microsoft Access Driver]Invalid precision value
|
I know that there is a property as follows ...
but how do i set "OdbcParameter.Precision" if my data ( which is inserted to database ) in binary format.....?
Please help me
Thanks in advance