我的代码
string strConnect ="PROVIDER=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=huangdonaldo;DATA Source=" + this.DBstring.Text;
OleDbConnection conConnection = new OleDbConnection ( strConnect ) ;
OleDbDataReader reader;
string strCommand = "select * from myslanGrade where njmc=" + this.SelectNJ.Text;
conConnection.Open();
OleDbCommand cmd = new OleDbCommand(strCommand, conConnection);
reader = cmd.ExecuteReader();
textBox1.Text = reader["njbh"].ToString ();大家帮忙啊!
string strConnect ="PROVIDER=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=huangdonaldo;DATA Source=" + this.DBstring.Text;
OleDbConnection conConnection = new OleDbConnection ( strConnect ) ;
OleDbDataReader reader;
string strCommand = "select * from myslanGrade where njmc=" + this.SelectNJ.Text;
conConnection.Open();
OleDbCommand cmd = new OleDbCommand(strCommand, conConnection);
reader = cmd.ExecuteReader();
textBox1.Text = reader["njbh"].ToString ();大家帮忙啊!
OleDbConnection conConnection = new OleDbConnection ( strConnect ) ;
OleDbDataReader reader;
//this.SelectNJ.Text应该加''
string strCommand = "select * from myslanGrade where njmc='" +this.SelectNJ.Text+"';
conConnection.Open();
OleDbCommand cmd = new OleDbCommand(strCommand, conConnection);
reader = cmd.ExecuteReader();
//reader前必须先reader.Reader()
reader.Reader() ;
textBox1.Text = reader["njbh"].ToString ();