sql 执行结果为什么总是返回-1 - .NET技术 / ASP.NET
//点击登录按钮进行登录,为什么总是执行 Response.Write("<script> alert('真的错了!')</script>");
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Server=.;database=Best;uid=sa;");
con.Open();
string sql = "select * from Userlogin where username='" + this.TextBox1.Text + "'and Pwd='" + this.TextBox2.Text + "'";
SqlCommand cmd = new SqlCommand(sql, con);
int i = Convert.ToInt32(cmd.ExecuteNonQuery());
con.Close();
if (i > 0)
{
Response.Redirect("Manger.aspx");
}
else if (i==0)
{
Response.Write("<script> alert('用户名和密码错误!')</script>");
}
else if(i<0)
{
Response.Write("<script> alert('真的错了!')</script>");
}
}
C# code:
string sql = "select * from Userlogin where username='" + this.TextBox1.Text + "'and Pwd='" + this.TextBox2.Text + "'";
这段
相关问答:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
我一个项目,有个插入操作,具体是这样的:
我有进货信息表。在出货时选择相应的进货信息,输入数量,选择部门后,点保存按钮,由于网络延时,点一下没有反映,于是用户就又点一下,导致一次插入了两条记录:
例:
......
现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......
如何在SQL2005中设定定时作业,比如说定时清理某些表的数据,
或者是定时的将某些表的数据导出excel!
在线等待,急急急,最好是详细步骤!
之前我做的作业有点问题!
帮UP
参考:http://hi.baidu.com/toiota ......
1.asp.net做的一个答题页面,如何实时限时后自动提交,请大家给点思路
限时的时间信息存放在数据库中
2.如果答题时间设置的较长,如何方式session超时后页面无效
谢谢
用js方法来控制
回复内容太短了。。
js ......