homepage Welcome to WebmasterWorld Guest from 54.211.230.186
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

    
Urgent Help : Microsoft VBScript compilation error '800a03f6'
VB script compilation error
pwint

5+ Year Member



 
Msg#: 8511 posted 2:39 am on Apr 25, 2005 (gmt 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
%>

 

txbakers

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



 
Msg#: 8511 posted 2:54 am on Apr 25, 2005 (gmt 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.

pwint

5+ Year Member



 
Msg#: 8511 posted 3:10 am on Apr 25, 2005 (gmt 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

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



 
Msg#: 8511 posted 3:21 am on Apr 25, 2005 (gmt 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

pwint

5+ Year Member



 
Msg#: 8511 posted 3:51 am on Apr 25, 2005 (gmt 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.

Staffa

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 8511 posted 11:00 am on Apr 25, 2005 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved