Forum Moderators: open
Expected end of statement
Erorr in this search file name is Search.asp
<FORM action="Search_Result.asp" method=POST id=form1 name=form1>
<select name="nm">
<%
dim objConn,my_sql,Rs
my_sql="Select name from Teaching order by name"
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("School.mdb"))
Set Rs=objConn.Execute(my_sql)
do while not Rs.EOF
Response.Write "<option value='" & Rs("Name")& "'>"
Response.Write Rs("Name")
Rs.MoveNext
loop
Rs.Close
Set objRs=nothing
objConn.close
Set objConn=nothing
%>
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/apspatiala/Search.asp, line 19
Response.Write ( objRs("Name") ) objRs.MoveNext
------------------------------------^
eriler it was givening error on braces which i included after response.write ok thanx in advance for lookign into the problmes
1- As mentioned earlier, you need to be consistent in what you call your recordset object. In some places you call it Rs and in some places you call it objRs. Call it one thing throughtout the file.
2- This line might be a problem:
Set Rs=objConn.Execute(my_sql)
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.Open my_sql, objConn
-Moz
<FORM action="Search_Result.asp" method=POST id=form1 name=form1>
<select name="nm">
<%
dim objConn,my_sql,objRs
my_sql="Select name from Teaching order by name"
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("School.mdb"))
Set objRs=objConn.Execute(my_sql)
do while not objRs.EOF
Response.Write "<option value='" & objRs("Name")& "'>"
Response.Write objRs("Name")
objRs.MoveNext
loop
objRs.Close
Set objRs=nothing
objConn.close
Set objConn=nothing
%>
no if statements yeah it gives errors somthing like this or on this line i mean
Microsoft VBScript compilation error '800a0401'
Expected end of statement
Search.asp, line 19
Response.Write ( objRs("Name") ) objRs.MoveNext
------------------------------------^
eriler it was givening error on braces which i included after response.write ok thanx in advance for lookign into the problmes