提示没有名字。。但是我设计界面的时候已经把相应的name改为txtname和txtPwd了。为什么还不行 啊????

protectedvoidButton1_Click(objectsender,EventArgse){stringuserName=this.txtName.Text.... protected void Button1_Click(object sender, EventArgs e)
{

string userName = this.txtName.Text.trim();
string password = this.txtPwd.Texttrim();
string connString = @"Data Source=3d8e899934c443e\SQLEXPRESS;Initial Catalog=wangjuan;Integrated Secruity=true";
SqlConnection connection = new SqlConnection(connString);
string sql = String.Format("select count(*) from (tb_user) where userName = '{0}' and Password='{1}'",userName,password);
//try
//{
connection.Open();
SqlCommand command = new SqlCommand(sql, connection);
int num = (int)command.ExecuteScalar();
if (num > 0)
{
Response.Redirect("~/Default2.aspx");
}

// }
// catch (Exception ex)
// {
// mbox(ex.Message,"ERROR!!",mbox.OK,);
// }
提示没有txtName和txtPwd,但是都肯定有改了名字的。。
展开
 我来答
mfvtxrw
2011-05-14 · TA获得超过2866个赞
知道小有建树答主
回答量:1556
采纳率:100%
帮助的人:846万
展开全部
现在网易就是s b,各种问题各种纠结~ GM你干脆就别问了 100%解决不了 直接打客服
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式