[求助] 数据库操作时 至少有一个参数没有赋值
string n = this.treeView1.SelectedNode.Text;string cnn = @" Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\工程\" + this.Text + ".lx";
this.oleDbConnection1.ConnectionString = cnn;
OleDbConnection cn = new OleDbConnection(cnn);
cn.Open();
string Sql = "select ProjectTableType from ProjectTable where ProjectTableName="+n;
this.oleDbCommand1.CommandText = Sql;
this.oleDbCommand1.Connection = this.oleDbConnection1;
//打开数据库连接
//this.oleDbConnection1.Open();
OleDbCommand cmd = new OleDbCommand(Sql, cn);
OleDbDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
string m = dr["ProjectTableType"].ToString();
}
cn.Close();
每次执行到红色的语句时就报错至少有一个参数没有赋值,这是为什么啊 ?