sql找不到存储过程怎么解决?用C#编写的代码如下。
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSys...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Data.Common;
public partial class pages_signup : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection sqlc = new SqlConnection();
sqlc.ConnectionString = "Data Source=R509-39;Initial Catalog=members;Integrated Security=True";//连接字符串
sqlc.Open();
string selectsql = TextBox1.Text.ToString();
string sqls = TextBox2.Text.ToString();
string selects = string.Format("select * from mem where nm=@cv AND pswd=@cs");
SqlCommand commql = new SqlCommand(selectsql,sqlc);//建立Command对象
commql.Parameters.Add(new SqlParameter("@cv", SqlDbType.Char))
commql.Parameters.Add(new SqlParameter("@cs", SqlDbType.VarChar));
commql.Parameters["@cv"].Value = TextBox1.Text;
commql.Parameters["@cs"].Value = TextBox2.Text;
string result = (string)commql.ExecuteScalar();
if (result == "0")
{
sqlc.Close();
Label1.Visible = true;
Label1.Text = "找不到该用户,登录失败!";
}
else
{
sqlc.Close();
Label1.Text =TextBox1.Text + "用户欢迎你!";
}
}
} 展开
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Data.Common;
public partial class pages_signup : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection sqlc = new SqlConnection();
sqlc.ConnectionString = "Data Source=R509-39;Initial Catalog=members;Integrated Security=True";//连接字符串
sqlc.Open();
string selectsql = TextBox1.Text.ToString();
string sqls = TextBox2.Text.ToString();
string selects = string.Format("select * from mem where nm=@cv AND pswd=@cs");
SqlCommand commql = new SqlCommand(selectsql,sqlc);//建立Command对象
commql.Parameters.Add(new SqlParameter("@cv", SqlDbType.Char))
commql.Parameters.Add(new SqlParameter("@cs", SqlDbType.VarChar));
commql.Parameters["@cv"].Value = TextBox1.Text;
commql.Parameters["@cs"].Value = TextBox2.Text;
string result = (string)commql.ExecuteScalar();
if (result == "0")
{
sqlc.Close();
Label1.Visible = true;
Label1.Text = "找不到该用户,登录失败!";
}
else
{
sqlc.Close();
Label1.Text =TextBox1.Text + "用户欢迎你!";
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询