string ConStr = "provider=Microsoft.jet.oledb.4.0;data source=" + Application.StartupPath + @"\MYText.mdb";
OleDbConnection Olecon = new OleDbConnection(ConStr);
Olecon.Open();
//string sql = "Select * from 学生信息 where 学号= '" + textBox1.Text.Trim() + "' ";
string sql = "Select Score ,Student from Student,Score where Score.STU_ID=Student.STU_ID";
//string sql = "Select * from Score where Score.STU_ID=Student.STU_ID";
//sql += sql + '"textBox1.Text.Trim()"';
OleDbDataAdapter da = new OleDbDataAdapter(sql, Olecon);
DataSet ds = new DataSet();
da.Fill(ds);
this.dataGridView1.DataSource = ds.Tables[0];
这是我的代码:
错误:至少一个参数没有被指定值
OleDbConnection Olecon = new OleDbConnection(ConStr);
Olecon.Open();
//string sql = "Select * from 学生信息 where 学号= '" + textBox1.Text.Trim() + "' ";
string sql = "Select Score ,Student from Student,Score where Score.STU_ID=Student.STU_ID";
//string sql = "Select * from Score where Score.STU_ID=Student.STU_ID";
//sql += sql + '"textBox1.Text.Trim()"';
OleDbDataAdapter da = new OleDbDataAdapter(sql, Olecon);
DataSet ds = new DataSet();
da.Fill(ds);
this.dataGridView1.DataSource = ds.Tables[0];
这是我的代码:
错误:至少一个参数没有被指定值
string sql = "Select * from Student,Score where Score.STU_ID=Student.STU_ID";
你加了么?
呵呵,有问题一起讨论啊……
where 学号= '" + textBox1.Text.Trim() + "'
如果学好是数字类型就
where 学号= " + textBox1.Text.Trim() + "
要是你们做过多表查询的发到邮箱[email protected],感激不尽啊