1
1楼 xiaoks668 2007-09-21 00:42:21 TextBox1,2分别为用户名,密码,运行下面的代码总是提示少个 "; " 请高手给出完整代码,立马给分。 protected void Button1_Click(object sender, EventArgs e) { string muser = Convert.ToString(Request.Form[ "TextBox1 "]); string mpass = Convert.ToString(Request.Form[ "TextBox2 "]); OleDbConnection myConn = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + Server.MapPath( "~/App_Data/xx.mdb ")); String strSQL= "SELECT * FROM [表名] WHERE admin_user= ' "+muser+ " ' and admin_pass= ' "+mpass+ " ' "; OleDbDataAdapter objCmd = New OleDbDataAdapter(strSQL,myConn); DataSet ds = New DataSet(); objCmd.Fill(ds, "表名 "); If (DS.Tables( "表名 ").Rows.Count=0); Response.Write( "登录错误! "); Else { Response.Write( "登录成功! "); Session( "admin_user ")=muser; Response.Redirect( "admin.aspx "); } } 2楼 LL223851 2007-09-21 02:03:58 If (DS.Tables( "表名 ").Rows.Count=0) { Response.Write( "登录错误! "); } 3楼 baye382 2007-09-21 02:42:40 老大 是小写的ds不是大写 是ds.Tables[ "表名 "].Rows.Count 不是() 还有你的if不加{}没关系 但你加个;是什么意思??? 4楼 yangpeiyu 2007-09-21 08:13:00 if (ds.Tables[ "表名 "].Rows.Count == 0); Response.Write( "登录错误! "); Else { Response.Write( "登录成功! "); Session[ "admin_user "]=muser; Response.Redirect( "admin.aspx "); } 5楼 yangpeiyu 2007-09-21 08:14:02 那 if () { ... } else { .... } 用小写。。建议楼主基础需要加强。 6楼 yangpeiyu 2007-09-21 08:15:42 if (ds.Tables[ "表名 "].Rows.Count == 0); Response.Write( "登录错误! "); else { Response.Write( "登录成功! "); Session[ "admin_user "]=muser; Response.Redirect( "admin.aspx "); } 帮你改了这段。上面的就没看了。楼主自己要看看。 7楼 LL223851 2007-10-07 17:34:47 天大的怪事,首发不是俺回的,俺没有参与这个帖子哦
搜索墙@2009 www.pkwall.com all rights reserved QQ:276471788 [京ICP备09111534号]
声明:本站部分数据来源于网络,仅供参考,如有版权问题,请联系我们,我们将及时删除!转载本站请注明来源
| |||||