Home > database >  GridView1 oracle for selected row numerical error: the object reference not set to an instance of an
GridView1 oracle for selected row numerical error: the object reference not set to an instance of an

Time:09-20

1, the load database
Using Oracle. ManagedDataAccess. Client;
 
Private void Form1_Load (object sender, EventArgs e)
{
The DataTable mytab=new DataTable ();
String SQL="select mids, mtitle from mail_model order by mid";
OracleConnection myconn=new OracleConnection (MyconnString);
OracleDataAdapter myda=new OracleDataAdapter (SQL, myconn);
Myda. The Fill (mytab);
GridControl1. The DataSource=mytab;
}

Line 2, double click on the select event:
 
Private void gridControl1_MouseDoubleClick (object sender, MouseEventArgs e)
{
TextBox1. Text=gridView1. GetFocusedRowCellValue (" mid "). The ToString ();===== error: the object reference not set to an instance of an object
TextBox2. Text=gridView1. GetFocusedRowCellValue (" mtitle "). The ToString ();
}

3, declare: the same way, using a SQL database won't be an error, using the oracle database error,
4, I have done in the same form in the experiment, two table reference SQL and oracle database experiments respectively, SQL, oracle,
  • Related