错误信息为:
错误 1 “System.Data.SqlClient.SqlCommand”不包含“ExecureScalar”的定义,并且找不到可接受类型为“System.Data.SqlClient.SqlCommand”的第一个参数的扩展方法“ExecureScalar”(是否缺少 using 指令或程序集引用?)
部分代码为:
SqlCommand cmd = new SqlCommand("select*from 员工 where name='" + textBox1 + "'and pwd='" + textBox2 + "'", con);
string sql = "select*from 员工 where name='" + textBox1 + "'and pwd='" + textBox2 + "'";
int i = Convert.ToInt32(cmd.ExecureScalar());
命名空间已经引用:using System.Data.SqlClient;
------解决思路----------------------
ExecureScalar ==> ExecuteScalar
------解决思路----------------------
using(SqlCommand command = new SqlCommand(strSql,conn))
{
// command.ExecuteScalar();
}