sqldatareader的问题~~
public SqlDataReader GetPersonData(string cPsnNum)
{
string selectStr = "select cPsn_Num,cPsn_Name from person where cPsn_Num= "+cPsnNum;
this.sqlC = new SqlConnection(DBOperate.connectStr);
this.sqlCmd = new SqlCommand(selectStr, this.sqlC);
this.sqlC.Open();
this.sqlDr = this.sqlCmd.ExecuteReader();
return this.sqlDr;
}
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.CurrentCell.OwningColumn.HeaderText == "人员编号 ")
{
if (dataGridView1.CurrentRow.DataBoundItem == null)
{
return;
}
else
{
dataGridView1.Visible = false;
tabControl1.Visible = true;
}
DBOperate dbop = new DBOperate();
SqlDataReader sdr = dbop.GetPersonData(dataGridView1.CurrentCell.Value.ToString());
sdr.Read();