你可以定义两个参数,或是直接写为
strSql="select * from userinfo where
loginname='" & textBox1.text &'"and password='" & textBox2.text&'";

解决方案 »

  1.   

    是这样这个语句在asp中应用没问题,但要asp.net中就会查不到数据的<!--#include file="data.asp" -->
    <%
       dim uname,upass,strsql
       dim rs   if request("username")="" and request("password")="" then
      Response.Redirect("login.asp?id=error")
       else
          Uname=request("username")
      Upass=request("password")      rs= Server.CreateObject("ADODB.Recordset") 

        strSql="select * from userinfo where loginname='"&uname&"' and password='"&Upass&"' "
     
      rs.open(strSql,Conn,1,1)

      if rs.eof then
                  response.Write("user not exists!")
      else  
           
          end if
    end if      rs.Close 
           rs=nothing      Conn.Close 
           Conn = nothing 
    %>
      

  2.   

    跟我的问题一样
    http://community.csdn.net/Expert/topic/3098/3098442.xml?temp=.2217676
    首先看看你的wen.config有没有
    <configuration>
      <system.web>
        <globalization fileEncoding="gb2312" requestEncoding="gb2312" responseEncoding="gb2312" />
      </system.web>
    </configuration>
    如果有了就 按 三楼说的 去 找个变量代替一下参考一下我的代码
      

  3.   

    lsg2003lsg(天空) 
    我确实没有 web.config,我该去哪找?谢谢
      

  4.   

    打开把
    <configuration>
      <system.web>
        <globalization fileEncoding="gb2312" requestEncoding="gb2312" responseEncoding="gb2312" />
      </system.web>
    </configuration>
    加进去就ok了
      

  5.   

    <configuration>
      <system.web>
        <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" />
      </system.web>
    </configuration>
    类似这个的有吧,在最低下
    不用管别的,把 utf-8 ---->gb2312 is ok