HOME > ASP > ASP Forum > อยากถาม Error Code ครับเกิดจากอะไร มันขึ้น Error ยังงี้อะครับ Microsoft VBScript compilation error '800a0401' Expected end of statement
อยากถาม Error Code ครับเกิดจากอะไร มันขึ้น Error ยังงี้อะครับ Microsoft VBScript compilation error '800a0401' Expected end of statement
'// 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>
<html>
<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>
strConn = "SELECT PROVINCE FROM MAP WHERE COUNTRY = '" & cont & "'"
set conn = Server.CreateObject("ADODB.Connection")
set Rs = Server.CreateObject("ADODB.Recordset")
conn.Open strConn ,conn,1,3
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
%>