// tablename : Map
// Fields list :ID,Country,Province
<%
Dim cont,conn,rs,I
cont = Request("country")
'// sub for list country name
Private Sub ListCountry()
set conn = Server.CreateObject("ADODB.Connection")
conn.Open strConn 'Connection string for your database
set rs = conn.Execute "SELECT DISTINCT(COUNTRY) FROM MAP"
Do while not Rs.EOF
Response.wite "<option value ='" & Rs("COUNTRY") & "'>" & Rs("COUNTRY") & "</option>" & vbCrLf
Rs.Movenext
Loop
Rs.close
Conn.close
set Rs = nothing
set conn = nothing
End Sub
'// sub for list all province that relate of conutry
Private Sub ListCountry()
set conn = Server.CreateObject("ADODB.Connection")
conn.Open strConn 'Connection string for your database
set rs = conn.Execute "SELECT PROVINCE FROM MAP WHERE COUNTRY = '" & cont & "'"
Do while not Rs.EOF
Response.wite "<option value ='" & Rs("PROVINCE") & "'>" & Rs("PROVINCE") & "</option>" & vbCrLf
Rs.Movenext
Loop
Rs.close
Conn.close
set Rs = nothing
set conn = nothing
End Sub
%>
<html><head><title>test</title></head>
<body>
<form name = 'frmTest' method = 'post' action = '#'>
<b>select your country</b><br>
<select name = 'country' onchange = 'document.forms[0].submit();'>
<option value = ''>--SELECT--</option>
<% Response.write ListCountry 'Call sub for list country name %>
</select><br>
<b>select your country</b><br>
<% If cont <> "" Then %>
<select name = 'province' onchange = 'document.forms[0].submit();'>
<option value = ''>--SELECT--</option>
<% Response.write ListProvince %>
</select>
<% Else %>
<select name = 'province' disabled>
<option value = ''>--SELECT--</option>
</select>
<% End If %>
</form>
</body>
</html>
Error ครับ*******************
Technical Information (for support personnel)
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/Project/drop/tetedrop2.asp, line 12, column 22
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Page:
GET /Project/drop/tetedrop2.asp
Time:
29 ตุลาคม 2551, 17:51:08
More information:
Microsoft Support
รบกวนด้วยนะครับ
ขอบพระคุณมากครับ
Tag : - - - -
Date :
29 ต.ค. 2551 17:55:13
By :
tete
View :
1886
Reply :
1
No. 1
Guest
Private Sub ListCountry() ชื่อเดียวกัน ยังไงก้อ Error