日期:2014-05-19  浏览次数:20349 次

急,sql语句出现问题!!
<%@   Page   Language= "C# "   %>
<%@   Import   Namespace= "System.Data "   %>
<%@   Import   Namespace= "System.Data.OleDb "   %>

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<script   runat= "server ">

        protected   void   Button1_Click(object   sender,   EventArgs   e)
        {
                string   dbname;
                dbname   =   Server.MapPath( "system.mdb ");

                OleDbConnection   conn   =   new   OleDbConnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA   Source= "   +   dbname);
                conn.Open();

                string   yonghu,   mima,sqlconn;
                yonghu   =   TextBox1.Text;
                mima   =   TextBox2.Text;
                sqlconn   =   "select   user,name   from   jhtuser   where   user   =   " "+   yonghu+ " "   and   pass   =   " "+mima+ " " ";
                OleDbCommand   cmd   =   new   OleDbCommand(sqlconn,   conn);


                OleDbDataReader   dr   =   cmd.ExecuteReader();
                if   (dr.Read())


                        Response.Redirect( "helps.htm ");  
                else

                        Response.Redirect( "index.asp ");  
        }

       
</script>

<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <title> 无标题页 </title>
</head>
<body>
        <form   id= "form1 "   runat= "server ">
        <div>
                <asp:Label   ID= "Label1 "   runat= "server "   Text= "用户名: "> </asp:Label>
                <asp:TextBox   ID= "TextBox1 "   runat= "server "   ValidationGroup= "TextBox1 "> </asp:TextBox>
                <asp:RequiredFieldValidator   ID= "RequiredFieldValidator1 "   runat= "server "   ErrorMessage= "请输入用户名! "   ControlToValidate= "