Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 4th, 2005, 05:34 PM
Registered User
 
Join Date: Feb 2005
Location: West Jordan, Utah, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Expected end

Hello,

I am a beginning programmer and I keep getting this message whan trying to edit my site in the backend.

The message is:

Microsoft VBScript compilation error '800a03f6'

Expected 'End'

/ds_change.asp, line 274


The code is this:

response.redirect "p_changed.asp"
    elseif dsNameInUse then ' Existing username
        response.redirect "ds_ae.asp?change=true&ae=edit&pID=" & eID & "&tID=" & tID & "&cID=" & cID & "&rID=" & rID
    else if dsAnother then
            response.redirect "ds_ae.asp?an=true&ae=add&tID=" & tID & "&rID=" & rID & "&pID=" & cID & "&cID=" & cID
        else
                 response.redirect "ds_view.asp?tID=" & tID & "&rID=" & rID & "&pID=" & cID
              end if
           end if
       %>


Please, your help is greatly needed and appreciated.

Thanks
Matt

 
Old February 4th, 2005, 05:47 PM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please check whether all the If .. End If paris are matching.
In case you don't find, Please paste ur code from the begining.

Om Prakash
 
Old February 4th, 2005, 06:27 PM
Registered User
 
Join Date: Feb 2005
Location: West Jordan, Utah, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the whole code.

any suggestions would be helpfull








<%


    dim dsDebugging, dsMailText
    Server.ScriptTimeout = 1000

    dsDebugging = "yes"
    dsCheckBoxFlag = false
    dsThumbNailer = true
    dsMaxWidth = 4000

    ' Initialize external objects
    set dsFSO = Server.CreateObject("Scripting.FileSystemObject")

    if dsThumbNailer then
        set dsSF = Server.CreateObject("SfImageResize.ImageResize")
        dsSFPro = false
        dsSFVer = dsSF.about()
        if inStr(dsSFVer, "Professional") then
            dsImgCompression = 30
            dsImgAlgorithm = 6
            dsSFPro = true
        end if
    end if

    dsMappath = server.mappath("uploads\") & "\"

    ae = request.querystring("ae")
    tID = request.querystring("tID")
    pID = request.querystring("pID")
    cID = request.querystring("cID")
    rID = request.querystring("rID")
    dsAnother = cbool(request.form("dsAddAnother"))

    ' Get the table's title
    rst.open "select [Title] from " & dsWebName & "Tables where " & dsWebName & "TablesID = " & tID, cnn, 1, 2
    if not rst.eof then
        dsTablesTitle = rst("Title")
    end if
    rst.close

    ' Open table to add or edit
    if (ae = "add") then
        ' Get the rank of the last record
        rst.open "select * from " & dsTablesTitle & " order by Rank desc", cnn, 1, 2
        if not rst.eof then
            dsRank = rst("Rank")
        end if
        rst.close

        rst.open "select * from " & dsTablesTitle, cnn, 1, 2
        rst.addnew
        rst("Rank") = dsRank + 1
        rst.update
            eID = rst(dsTablesTitle & "ID")
        rst.close
        rst.open "select * from " & dsTablesTitle & " where " & dsTablesTitle & "ID = " & eID, cnn, 1, 2
    else
        rst.open "select * from " & dsTablesTitle & " where " & dsTablesTitle & "ID = " & pID, cnn, 1, 2
        eID = pID
    end if

    rst("Active") = "yes"

    dsLog(ae & " " & eID & " " & tID)
    dsIndex = 1

    'Open fields
    rst2.open "select * from " & dsWebName & "Fields where " & dsWebName & "TablesID = " & tID & " and Display = 'yes' order by Rank, " & dsWebName & "FieldsID", cnn, 1, 2
    do while not rst2.eof

        dsFieldsTitle = rst2("Title")
        dsFieldsDesc = rst2("Desc")
        dsFieldsData = request.form(rst2("Required") & ":" & rst2("Type") & ":" & rst2("Title"))

        if (rst2("Type") = "username") then
            sqltext = "select [" & dsTablesTitle & "ID] from " & dsTablesTitle & " WHERE " & dsFieldsTitle & " = '" & dsFieldsData & "'"
            if (ae = "edit") then
                sqltext = sqltext & " and " & dsTablesTitle & "ID <> " & pID
            end if

            rstd.open sqltext, cnn, 1, 2
            if not rstd.EOF then
                dsNameInUse = true
            else
                rst(dsFieldsTitle) = dsFieldsData
            end if
            rstd.close
        elseif (rst2("Type") = "image") then

            if dsThumbNailer then
                if ((ae = "add") or (ae = "edit" and rst(dsFieldsTitle) <> dsFieldsData)) then

                    dsImageIndex = 0
                    rstd.open "select [Title] from " & dsWebName & "Fields where " & dsWebName & "TablesID = " & tID & " and Display = 'yes' and Type = 'image'", cnn, 1, 2
                    do while not rstd.eof

                        dsImageIndex = dsImageIndex + 1
                        if (rstd("Title") = dsFieldsTitle) then
                            rstd.movelast
                        end if

                    rstd.movenext
                    loop
                    rstd.close

                    dsThumbName = "thumb_" & tID & "_" & eID & "_" & dsImageIndex & "_"

                    if (dsFieldsData <> "No File") then
                        dsSF.LoadFromFile dsMappath & dsFieldsData
                        if (dsSF.Width >= rst2("Size")) then
                            dsSF.Width = rst2("Size")
                            if dsSFPro then
                                dsSF.Compression = dsImgCompression
                                dsSF.Algorithm = dsImgAlgorithm
                            end if
                            dsSF.DoResize
                        end if

                        dsSF.SaveToFile dsMappath & dsThumbName & dsFieldsData
                        dsLog(ae & " uploads/" & dsThumbName & dsFieldsData)
                    end if

                    if (ae = "edit") then
                        dsPath = dsMappath & dsThumbName & rst(dsFieldsTitle)
                        if (dsFSO.FileExists(dsPath) = true) then
                            dsFSO.DeleteFile dsPath, false
                        end if
                    end if

                end if

            end if

            rst(dsFieldsTitle) = dsFieldsData
        elseif (rst2("Type") = "checkbox") then

            'Get Data table information
            dsDataTablesTitle = dsFieldsTitle

            'Get Dropdown table information
            dsDropTablesID = rst2(dsWebName & "RelatedID")

            rstd.open "select [Title] from " & dsWebName & "Tables where " & dsWebName & "TablesID = " & dsDropTablesID & " and Active = 'yes'", cnn, 1, 2
            if not rstd.eof then
                dsDropTablesTitle = rstd("Title")
            end if
            rstd.close

            ' Delete existing records
            if ae = "edit" then
                rstd.open "delete from " & dsDataTablesTitle & " where " & dsTablesTitle & "ID = " & pID, cnn, 1, 2
            end if

            ' Get Form data
            dsCheckboxData = split(dsFieldsData, ", ")

            dsRankIndex = 1
            rstd.open "select [Active], [Rank], [" & dsDropTablesTitle & "ID], [" & dsTablesTitle & "ID] from " & dsDataTablesTitle, cnn, 1, 2
            for i = 0 to UBound(dsCheckboxData)
                rstd.addnew
                rstd("Active") = "yes"
                rstd("Rank") = dsRankIndex
                rstd(dsDropTablesTitle & "ID") = dsCheckboxData(i)
                rstd(dsTablesTitle & "ID") = eID
                rstd.update

                dsRankIndex = dsRankIndex + 1
            next
            rstd.close
        elseif (rst2("Type") = "modifier") then
            dsNewModifiers = dsFieldsData

            dsMod = split(dsFieldsTitle, ",")
            if (uBound(dsMod) = 3) then
                dsModGroup = dsMod(0)
                dsModTable = dsMod(1)
                dsModPrices = dsMod(2)
                dsModCombo = dsMod(3)
            end if

            if (ae = "edit") then
                dsOldModifiers = rst(dsModTable)
                if (dsOldModifiers <> "") then
                    dsOldModArray = split(dsOldModifiers, ",")
                else
                    dim dsOldModArray(0)
                    dsOldModArray(0) = 0
                end if

                for i = 0 to uBound(dsOldModArray)
                    if (instr(" " & dsNewModifiers & ",", " " & cint(dsOldModArray(i)) & ",") = 0) then
                        rstd.open "select * from " & dsModTable & " where " & dsModGroup & "ID = " & dsOldModArray(i) & " and Active = 'yes' order by Rank", cnn, 1, 2
                        do while not rstd.eof
                            cnn.execute ("delete from " & dsModPrices & " where " & dsTablesTitle & "ID = " & eID & " and " & dsModTable & "ID = " & rstd(dsModTable & "ID"))
                            rstd.movenext
                        loop
                        rstd.close
                    end if
                next

            end if

            if dsNewModifiers <> "" then
                dsModifiers = true
            end if

            rst(dsModTable) = dsNewModifiers
        elseif (rst2("Type") = "ftext") then
            dsCleanText = replace(dsFieldsData, "<PRE>", "")
            dsCleanText = replace(dsCleanText, "</PRE>", "")

            dsMailText = dsMailText & dsFieldsDesc & ": " & dsCleanText & vbcrlf

            rst(dsFieldsTitle) = dsCleanText
        else
            dsMailText = dsMailText & dsFieldsDesc & ": " & dsFieldsData & vbcrlf

           If not isempty(rstat) then
            rst(dsFieldsTitle) = dsFieldsData
        end if

        if dsDebugging = "yes" then ' If Debugging is on
            response.write dsIndex & ") dsFieldsTitle: " & dsFieldsTitle & "<br>dsFieldsData: " & dsFieldsData & "<br><br>"
        end if

     dsIndex = dsIndex + 1
            rst2.movenext


    rst2.close

    rst.update
    rst.close

    if (dsThumbNailer) then
        set dsSF = nothing
    end if

    set dsFSO = nothing
    cnn.close

    if dsModifiers then
        response.redirect "ds_modifiers.asp?tID=" & tID & "&pID=" & eID & "&rID=" & rID & "&cID=" & cID & "&an=" & dsAnother
    elseif tID = 0 then

        Set dsMailer = Server.CreateObject("SMTPsvg.Mailer")

' dsMailer.RemoteHost = "mssql.ixwebhosting.com"
        dsMailer.RemoteHost = "69.49.230.7"
        dsMailer.FromName = ""
        dsMailer.FromAddress = "support@cjmsolutions.net"
        dsMailer.AddRecipient "", "info@.com"
' dsMailer.AddRecipient "", "mhafoka@cjmsolutions.net"
        dsMailer.Subject = "Contact Form"
        dsMailer.BodyText = dsMailText
        if dsMailer.SendMail then
            dsEmail = "sent"
        else
            response.write dsMailer.Response
        end if

                              response.redirect "p_changed.asp"
     elseif dsNameInUse then ' Existing username
           response.redirect "ds_ae.asp?change=true&ae=edit&pID=" & eID & "&tID=" & tID & "&cID=" & cID & "&rID=" & rID
     else if dsAnother then
                 response.redirect "ds_ae.asp?an=true&ae=add&tID=" & tID & "&rID=" & rID & "&pID=" & cID & "&cID=" & cID
           else
                 response.redirect "ds_view.asp?tID=" & tID & "&rID=" & rID & "&pID=" & cID
              end if
           end if
        %>

 
Old February 4th, 2005, 06:42 PM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

PLease check in the following Loop

do while not rst2.eof

        else
            dsMailText = dsMailText & dsFieldsDesc & ": " & dsFieldsData & vbcrlf

           If not isempty(rstat) then
            rst(dsFieldsTitle) = dsFieldsData
        end if


there is no end if.....


        else
            dsMailText = dsMailText & dsFieldsDesc & ": " & dsFieldsData & vbcrlf

           If not isempty(rstat) then
              rst(dsFieldsTitle) = dsFieldsData
            end if
  end if


Om Prakash
 
Old February 4th, 2005, 09:53 PM
Registered User
 
Join Date: Feb 2005
Location: West Jordan, Utah, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Om_prakash

I am now getting this error when I made those changes. I made that change before and got the same eroor but changed it back as I thought I did something wrong. Anyway the error is as follows:

Microsoft VBScript compilation error '800a03fb'

Expected 'Loop'

/ds_change.asp, line 274
  line 274 is the last end if in the code. I dont know why I am getting that error as I am ending and beginning a loop.

Thanks

 
Old January 17th, 2006, 10:19 AM
Registered User
 
Join Date: Jan 2006
Location: , , Antigua and Barbuda.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You have ended your if statements, but you have not ended your loop.

Following your last end if should be:

rst2.MoveNext 'so you dont loop over the same record forever
Loop 'which restarts execution of the loop...





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Expected end of statement crabjoe Classic ASP Basics 3 December 4th, 2007 12:52 AM
Oracle Back End - MS Access Front End - Multi User ckaliveas Oracle 1 February 1st, 2007 06:00 AM
expected end of statement Adam H-W Classic ASP Databases 3 January 4th, 2005 05:37 AM
(0x800A03F6) Expected 'End' walrus Classic ASP Databases 5 April 15th, 2004 04:10 AM
expected end of statement....help.... chaoz83 Classic ASP Databases 3 September 23rd, 2003 01:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.