科技行者

行者学院 转型私董会 科技行者专题报道 网红大战科技行者

知识库

知识库 安全导航

至顶网软件频道如何创建WML电话薄(二)

如何创建WML电话薄(二)

  • 扫一扫
    分享文章到微信

  • 扫一扫
    关注官方公众号
    至顶头条

在上篇文章中,我讨论了无线标记语言(Wireless Markup Language 即WML),并且为我的WML公司目录建立了介绍性的界面。现在我将建立动态服务器界面,这个界面将为搜索到的电话号码建立WML。

作者:builder.com.cn 2007年1月18日

关键字:

  • 评论
  • 分享微博
  • 分享邮件

<%@ Language=VBScript %>

<%

Response.ContentType = "text/vnd.wap.wml"

Response.Expires = -1

Dim qt, qv, n

Dim rs, conn

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

conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &

Server.MapPath("../test.mdb") & ";User Id=;Password=;"

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

Set rs.ActiveConnection = conn

qt = Request("qt")

qv = Request("qv")

%>

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"

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

<wml>

<card id="main" title="Select">

<do type="prev">

<go href="wap1.asp"/>

</do>

<p>

<%

If qt = "loc" Then

If qv = "" Then

rs.Open "SELECT * FROM tblLocation"

Response.Write "<select name=""qv"">" &

vbCrLf

Do While Not rs.EOF

Response.Write vbTab & "<option value=""" &

rs.Fields("location_id") & """>" &

_

rs.Fields("location") & "</option>" &

vbCrLf

rs.MoveNext

Loop

Response.Write "</select><br/>" & vbCrLf

Response.Write "<anchor>Submit" & vbCrLf & _

"<go href=""search.asp"" method=""post"">"

& vbCrLf & _

"<postfield name=""qt"" value=""dpt""/>"

& vbCrLf & _

"<postfield name=""qv"" value=""$qv""/>"

& vbCrLf & _

"</go>" & vbCrLf & _

"</anchor>"

Else

sql = "SELECT tblPhone.* " & _

"FROM tblPhone " & _

"INNER JOIN tblLocation " & _

"ON tblLocation.location_id = tblPhone.location_id " & _

"WHERE tblLocation.location_id = " & qv

If Request("pid") > 0 Then sql = sql & " AND phone_id

> " &

Request("pid")

sql = sql & " ORDER BY tblPhone.last_name"

rs.Open sql

n = 0

Do While n < 5 And Not rs.EOF

n = n + 1

Response.Write "<anchor>" & rs.Fields("last_name")

& ", " & _

rs.Fields("first_name") & vbCrLf & _

"<go href=""data.asp"" method=""post"">"

&

vbCrLf & _

"<postfield name=""pid"" value="""

&

rs.Fields("phone_id") & """/>" & vbCrLf

& _

"</go>" & vbCrLf & _

"</anchor><br/>"

rs.MoveNext

Loop

If Not rs.EOF Then

Response.Write "<anchor>More..." & vbCrLf & _

"<go href=""search.asp"" method=""post"">"

& vbCrLf & _

"<postfield name=""qt"" value=""loc""/>"

& vbCrLf & _

"<postfield name=""qv"" value="""

& qt & """/>" &

vbCrLf & _

"<postfield name=""pid"" value="""

&

rs.Fields("phone_id") & """/>" & vbCrLf

& _

"</go>" & vbCrLf & _

"</anchor>"

End If

End If

ElseIf qt = "dpt" Then

If qv = "" Then

rs.Open "SELECT * FROM tblDepartment"

Response.Write "<select name=""qv"">" &

vbCrLf

Do While Not rs.EOF

Response.Write vbTab & "<option value=""" & rs.Fields("deptid")

&

""">" & _

rs.Fields("dept") & "</option>" & vbCrLf

rs.MoveNext

Loop

Response.Write "</select><br/>" & vbCrLf

Response.Write "<anchor>Submit" & vbCrLf & _

"<go href=""search.asp"" method=""post"">"

& vbCrLf & _

"<postfield name=""qt"" value=""dpt""/>"

& vbCrLf & _

"<postfield name=""qv"" value=""$qv""/>"

& vbCrLf & _

"</go>" & vbCrLf & _

"</anchor>"

Else

sql = "SELECT tblPhone.* " & _

"FROM tblPhone " & _

"INNER JOIN tblDepartment " & _

"ON tblDepartment.deptid = tblPhone.location_id " & _

"WHERE tblDepartment.deptid = " & qv

If Request("pid") > 0 Then sql = sql & " AND phone_id

> " &

Request("pid")

sql = sql & " ORDER BY tblPhone.last_name"

rs.Open sql

n = 0

Do While n < 5 And Not rs.EOF

n = n + 1

Response.Write "<anchor>" & rs.Fields("last_name")

& ", " & _

rs.Fields("first_name") & vbCrLf & _

"<go href=""data.asp"" method=""post"">"

&

vbCrLf & _

 

"<postfield name=""pid"" value="""

&

rs.Fields("phone_id") & """/>" & vbCrLf

& _

"</go>" & vbCrLf & _

"</anchor><br/>"

rs.MoveNext

Loop

If Not rs.EOF Then

Response.Write "<anchor>More..." & vbCrLf & _

"<go href=""search.asp"" method=""post"">"

& vbCrLf & _

"<postfield name=""qt"" value=""dpt""/>"

& vbCrLf & _

"<postfield name=""qv"" value="""

& qt & """/>" &

vbCrLf & _

"<postfield name=""pid"" value="""

&

rs.Fields("phone_id") & """/>" & vbCrLf

& _

"</go>" & vbCrLf & _

"</anchor>"

End If

End If

ElseIf qt = "fn" Then

sql = "SELECT tblPhone.* " & _

"FROM tblPhone " & _

"INNER JOIN tblDepartment " & _

"ON tblDepartment.deptid = tblPhone.location_id " & _

"WHERE tblPhone.first_name LIKE '" & qv & "%'"

If Request("pid") > 0 Then sql = sql & " AND phone_id

> " & Request("pid")

sql = sql & " ORDER BY tblPhone.phone_id"

rs.Open

n = 0

Do While n < 5 And Not rs.EOF

n = n + 1

Response.Write "<anchor>" & rs.Fields("last_name")

& ", " & _

rs.Fields("first_name") & vbCrLf & _

"<go href=""data.asp"" method=""post"">"

& vbCrLf &

_

"<postfield name=""pid"" value="""

&

rs.Fields("phone_id") & """/>" & vbCrLf

& _

"</go>" & vbCrLf & _

"</anchor><br/>"

rs.MoveNext

Loop

If Not rs.EOF Then

Response.Write "<anchor>More..." & vbCrLf & _

"<go href=""search.asp"" method=""post"">"

& vbCrLf & _

"<postfield name=""qt"" value=""fn""/>"

& vbCrLf & _

"<postfield name=""qv"" value="""

& qv & """/>" & vbCrLf &

_

"<postfield name=""pid"" value="""

& rs.Fields("phone_id")

& """/>" & vbCrLf & _

"</go>" & vbCrLf & _

"</anchor>"

End If

ElseIf qt = "ln" Then

sql = "SELECT tblPhone.* " & _

"FROM tblPhone " & _

"INNER JOIN tblDepartment " & _

"ON tblDepartment.deptid = tblPhone.location_id " & _

"WHERE tblPhone.last_name LIKE '" & qv & "%'"

If Request("pid") > 0 Then sql = sql & " AND phone_id

>= " & Request("pid")

sql = sql & " ORDER BY tblPhone.phone_id"

rs.Open sql

n = 0

Do While n < 5 And Not rs.EOF

n = n + 1

Response.Write "<anchor>" & rs.Fields("last_name")

& ", " & _

rs.Fields("first_name") & vbCrLf & _

"<go href=""data.asp"" method=""post"">"

& vbCrLf &

_

"<postfield name=""pid"" value="""

&

rs.Fields("phone_id") & """/>" & vbCrLf

& _

"</go>" & vbCrLf & _

"</anchor><br/>"

rs.MoveNext

Loop

If Not rs.EOF Then

Response.Write "<anchor>More..." & vbCrLf & _

"<go href=""search.asp"" method=""post"">"

& vbCrLf & _

"<postfield name=""qt"" value=""ln""/>"

& vbCrLf & _

"<postfield name=""qv"" value="""

& qv & """/>" & vbCrLf &

_

"<postfield name=""pid"" value="""

& rs.Fields("phone_id")

& """/>" & vbCrLf & _

"</go>" & vbCrLf & _

"</anchor>"

End If

End If

%>

</p>

</card>

</wml>

<%

On Error Resume Next

rs.Close

Set rs = Nothing

conn.Close

Set conn = Nothing

%>

    • 评论
    • 分享微博
    • 分享邮件
    邮件订阅

    如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。

    重磅专题
    往期文章
    最新文章