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 + "'";
这段
相关问答:
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......
字段1,字段2.....字段N,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
想要的结果是:
1,Na ......
就是一个按钮,点击之后打开对话框,然后选取图片。就这样上传。。
怎么实现。在网上搜到那么多的代码,全是很多的那种,不知道,看不下去。
所以在这里想请大哥大姐帮帮忙。
使用自带的fileupload控件可以实现 ......
1。怎样使xp_cmdshell能完整输出超过255个字符的字符串。
2。select 时,检索速度是与from后的 TABLE顺序有关,还是与where条件的顺序有关(TABLE数据多少 )
在系统属性设定里有个选项,可以修改单字段输出字数限制. ......