ASP.NET索引或主关键字不能包含一个 空 (Null) 值
OleDbConnection thisConnection=new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\mysky\goon\dbs\PL.mdb");thisConnection.Open();OleDbCommand thisCmd=thisConnection.CreateCommand();thisCmd.CommandText="Insert into dcy([name],[content])values('"+this.name.Text+"','"+this.content.Text+"')";thisCmd.ExecuteNonQuery();OleDbCommand thisCmd2=thisConnection.CreateCommand();thisCmd2.CommandText="SELECT name,content FROM dcy WHERE name='"+this.name.Text+"'and content='"+this.content.Text+"'";thisCmd2.ExecuteNonQuery();//编译时提示这句出错,,OleDbDataReader thisReader=thisCmd2.ExecuteReader();if(thisReader.Read()) Response.Redirect("dcyok.htm");else Response.Redirect("dcyno.htm");thisConnection.Close();///////麻烦大家帮我看一下,,当局者迷啊!!加10分
参考答案:ExecuteNonQuery();是不能用于select语句的其他的象update,delete是可以的