主题:[原创]怎样才能改变row的值(当MouseUp至dataGridd1时,得到当前行的索引)
private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
conn = new OracleConnection(connStr);
oda = new OracleDataAdapter("select * from DATAINF",conn);
OracleCommandBuilder cc = new OracleCommandBuilder(oda);
ds = new DataSet();
oda.Fill(ds,"DATAINF");
dataGrid1.DataSource = ds.Tables["DATAINF"];
row=dataGrid1.CurrentRowIndex;
textBox1.Text=row.ToString();
}
{
conn = new OracleConnection(connStr);
oda = new OracleDataAdapter("select * from DATAINF",conn);
OracleCommandBuilder cc = new OracleCommandBuilder(oda);
ds = new DataSet();
oda.Fill(ds,"DATAINF");
dataGrid1.DataSource = ds.Tables["DATAINF"];
row=dataGrid1.CurrentRowIndex;
textBox1.Text=row.ToString();
}