cmd.CommandType = CommandType.StoredProcedure;
你指明的是要调用存储过程,你没给出存储过程的名字,而你用的是sql语句,当然不识别了
你指明的是要调用存储过程,你没给出存储过程的名字,而你用的是sql语句,当然不识别了
解决方案 »
- VS环境出问题了?还是IE出问题了。真是让我蛋疼!!!帮帮小弟。
- 数据库怎么判断这一列有没有某一个值,比如我的数据库中的某一列有1,2,3...我怎么判断这一列是否有1。
- 呈现控件(.ascx自定义)时出错,发生了未处理的异常。
- 高手过来帮下忙!关于页面执行时间超时的问题!!急!!!!
- 帮帮忙各位
- treeview的问题
- 有没有人知道ASP.NET中TreeView控件点击节点时,触发的是哪个事件啊?
- 什么时候可以把ViewState设置为 false ,以便减少网络传输!
- ASP.NET web application中如何调用winzip命令行对上传的多个文件打包压缩?
- apsx程序无法找到脚本库的错误
- ASP.NET 下如何构建持续集成环境
- 求救 win2008 r2 web服务器 发布网站 一直不成功
改成
cmd.CommandType = CommandType.Text;
这东西你直接放数据库里执行也一样执行不成功啊
protected void btnLoad_Click(object sender, ImageClickEventArgs e)
{
HttpCookie cookie = Request.Cookies["CheckCode"];
if (String.Compare(cookie.Value, txtVali.Text, true) != 0)
{ Response.Write("<script lanuage=javascript>alert('验证码错误');location='javascript:history.go(-1)'</script>");
} else
{
DataSet ds = DB.reDs("select * from tb_HuenLian where UserName='" + txtUid.Text.Trim() + "' and PassWord='" + txtPwd.Text.Trim() + "'");
int i = this.checkLogin(txtUid.Text, txtPwd.Text);
if (i > 0)
{
Session["id"] = ds.Tables[0].Rows[0][0].ToString();
Session["UserName"] = this.txtUid.Text;
Session["PassWord"] = this.txtPwd.Text;
Page.Response.Redirect("Yonghu.aspx");
}
else
{
Response.Write("<script lanuage=javascript>alert('用户名称或密码错误!');location='javascript:history.go(-1)'</script>");
}
}//codego.net/tags/11/1/
}
public int checkLogin(string loginName, string loginPwd)
{
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["conn"]);
SqlCommand myCommand = new SqlCommand("select count(*) from tb_HuenLian where UserName=@loginName and PassWord=@loginPwd", con);
myCommand.Parameters.Add(new SqlParameter("@loginName", SqlDbType.NVarChar, 20));
myCommand.Parameters["@loginName"].Value = loginName;
myCommand.Parameters.Add(new SqlParameter("@loginPwd", SqlDbType.NVarChar, 50));
myCommand.Parameters["@loginPwd"].Value = loginPwd;
myCommand.Connection.Open();
int i = (int)myCommand.ExecuteScalar();
myCommand.Connection.Close();
return i;
}
隔开一个空格
Insert into Table(user_login,user_password) Values(@user_login,@user_password)
没有人告诉你改了只后你的代码完全“可以”了,你解决了你贴出的那个“Could not find stored procedure .....”异常,那么你这就贴出“下一个异常”求助别人。如果你有2个错误,人家帮你解决了第一个,你非要说人家“不可以”,人家以后就不帮你了。
没有人告诉你改了只后你的代码完全“可以”了,你解决了你贴出的那个“Could not find stored procedure .....”异常,那么你这就贴出“下一个异常”求助别人。如果你有2个错误,人家帮你解决了第一个,你非要说人家“不可以”,人家以后就不帮你了。第一次发帖子 不知道具体怎么整 ,多谢提醒 ,,今后注意!