Hi,
I'm using the oleDbDataReader HasRows properties to detect wheter my
table contains a record with the parameter below:
oleDbConnection 1.Close();
objreturnst.Par ameters["DEPT_CODE"].Value = comboBox2.Text;
objreturnst.Par ameters["ST_CODE"].Value = comboBox1.Text;
oleDbConnection 1.Open();
OleDbDataReader objreturn = objreturnst.Exe cuteReader();
if(objreturn.Ha sRows) --> this should be false, but it seems it is
always true.. :(
{
objreturn.Read( );
retqty = Convert.ToDoubl e(objreturn["Expr1"]);
}
The SQL statement is:
this.objreturns t.CommandText = "SELECT SUM(TRAN_QTY) AS Expr1 FROM
TRAN2005 WHERE (TRAN_TYPE = \'7\') AND (DEPT_CODE = ?) AND (ST_CODE =
?)";
Since the expression objreturn.HasRo ws isn't false, so it will generate
the error: Object cannot be cast from DBNull to other types.
I don't know if there's any mistakes in my code, but can someone help
me?
Cheers!
Claudi
*** Sent via Developersdex
http://www.developersdex.com ***