I am trying to return INTEGER
value from Oracle Database using C# but it is giving me following Exception
An unhandled exception of type 'System.InvalidCastException' occurred in System.Data.dll
Additional information: Specified cast is not valid.
Can anyone help me to resolve this?
Here is my code:
OleDbConnection con = new OleDbConnection(
"Provider=MSDAORA;Data Source=xe;User ID=hr; password=123");
con.Open();
String cmd1 =
@"select retail_price,purchase_price from
productdetails where item_name='" + textBox1.Text + "'";
OleDbCommand a1 = new OleDbCommand(cmd1, con);
OleDbDataReader myReader = a1.ExecuteReader();
if (myReader.Read())
{
int m = myReader.GetInt32(0);
MessageBox.Show("" +m);
}