Welcome to WebmasterWorld Guest from 54.160.221.82

Forum Moderators: phranque

Message Too Old, No Replies

Urgent Help : Microsoft VBScript compilation error '800a03f6'

VB script compilation error

     
2:39 am on Apr 25, 2005 (gmt 0)

New User

10+ Year Member

joined:Apr 25, 2005
posts:9
votes: 0


Hi
I got the error in the last sentence " set sqlstmt=nothing" the expected end . But I aleady have the end if statement. How can i solve this,please?
Thanks in advance.

<%
Dim conn,sqlstmt,sDataName,sISource,sIDate,sIValue,sPValue,sPDate,sPSource,sDataId

sDataId = request.Form("DataList")
sRType = request.Form("ReportType")

if sRType = 111 then
response.Redirect("/pmf/ReportType1.asp")
else if sRType = 2 then
response.Redirect("/pmf/ReportType2.asp")
else if sRType = 3 then
response.Redirect("/pmf/ReportType3.asp")
else if sRType = 41 then
response.Redirect("/pmf/ReportType41.asp")
else if sRType = 42 then
response.Redirect("/pmf/ReportType42.asp")
else if sRType = 5 then
response.Redirect("/pmf/ReportType5.asp")
else if sRType = 61 then
response.Redirect("/pmf/ReportType61.asp")
else if sRType = 62 then
response.Redirect("/pmf/ReportType62.asp")
else if sRType = 7 then
response.Redirect("/pmf/ReportType7.asp")
else
set conn=Server.CreateObject("ADODB.Connection")
conn.open "Driver={SQL Server};" & _
"Server=(local);" & _
"Database=UEMAPmf;" & _
"Uid=sa;" & _
"Password=#*$!xx"

sqlstmt = "Select reporttype from PmfIndicators p,IndicatorData d where " & _
" p.indicatorno = d.datanumber and p.indicatorno = '" & sRType & "'"

set rsSelect= server.CreateObject("ADODB.recordset")
rsSelect.open sqlstmt, conn

sType = rsSelect.fields("reporttype")

rsSelect.close
end if
set rsSelect=nothing
conn.close
set conn=nothing
set sqlstmt=nothing
%>

2:54 am on Apr 25, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member txbakers is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Sept 1, 2001
posts:4392
votes: 0


Hi and welcome to the WEbmaster World. Most likely this post will be moved to the Microsoft/ASP area but here's what I think:

rsSelect.open sqlstmt, conn

sType = rsSelect.fields("reporttype")

rsSelect.close
set sqlstmt=nothing
end if
set rsSelect=nothing
conn.close

set conn=nothing

Try moving that line in red to that position and see if it helps.

3:10 am on Apr 25, 2005 (gmt 0)

New User

10+ Year Member

joined:Apr 25, 2005
posts:9
votes: 0


Thanks for your suggestion.
I tried to correct according to your suggestion . But still has the error:

Microsoft VBScript compilation error '800a03f6'

Expected 'End'

/pmf/PmfReportSelectType.asp, line 54

How can i find the problem , please?

Thanks

Woz

3:21 am on Apr 25, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member woz is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 13, 2000
posts:4823
votes: 0


On a quick look, you are creating some objects (eg, conn) inside the If/End If loop under certain conditions, but cleaning them outside the loop. They cannot be destroyed if they have not been created. You need to move conn.close & set conn=nothing inside the looop for a start. Try that and see how you go.

Onya
Woz

3:51 am on Apr 25, 2005 (gmt 0)

New User

10+ Year Member

joined:Apr 25, 2005
posts:9
votes: 0


Hi
I'm trying according to your suggestion. But i got the same error.

**************************************
sType = rsSelect.fields("reporttype")

rsSelect.close
set sqlstmt=nothing
set rsSelect=nothing
conn.close
set conn=nothing
end if
*****************************************
How can i sove it please?

Thanks.

11:00 am on Apr 25, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 24, 2002
posts:894
votes: 0


You first set a range of conditions resulting in a redirect to another page :

if sRType = 111 then
response.Redirect("/pmf/ReportType1.asp")
else if sRType = 2 then .................

If one of these conditions is met the visitor is redirected and the conditions can be closed.

End if

If none of these conditions were met then move on to the next action :

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

If you still have a problem than change 'else if' to 'elseif' that's how I've always seen it written.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members