PC6下载站

分类分类

用ASP和WML来实现数据库查询

关注+2004-11-07作者:蓝点

Shows how to perform a search with a WAP page and use ASP on the server to do the database query and then

display the results.





<%Response.ContentType = "text/vnd.wap.wml"%>


1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">



<%  

    Dim conn, rs  

    Dim strSQL,strFirstName, strLastName   

    Set conn = Server.CreateObject("ADODB.Connection")

    Set rs   = Server.CreateObject("ADODB.Recordset")



    conn.open session("myconnect_string") 'Replace with your connect string  



    strWhoIs = Request.QueryString("username")

    if strWhoIs="" then

%>

      

       



          Please enter username to find?

             

                

                   

                


             
     

       



    


<%

    else

    strSQL = "SELECT * FROM tblUsers WHERE Username ='& strWhoIs & '"

    Set rs = conn.Execute(strSQL)

      

%>  

         

            

<%

          if not rs.EOF then

           rs.MoveFirst

              Response.Write "User Search Results"

              While not rs.EOF

                 strFirstName = "First Name " & rs("FirstName")

                 strLastName = "Last Name " & rs("LastName")

                 Response.Write strFirstName

                 Response.Write strLastName

                 rs.MoveNext          

              Wend

          else

              Response.Write "Sorry, no user found."

          end if

%>

         



       


<%

    end if

%>






展开全部

相关文章

更多+相同厂商

热门推荐

  • 最新排行
  • 最热排行
  • 评分最高
排行榜

    点击查看更多

      点击查看更多

        点击查看更多

        说两句网友评论

          我要评论...
          取消