Wrox Programmer Forums
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional 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 April 11th, 2007, 11:30 AM
Authorized User
Join Date: Jan 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jonsey Send a message via Yahoo to jonsey
Default Update DB by passing ID number

What I'm doing is pulling data into my form by a ID number. What I need to do is update two table in the DB here is what I have so far. I keep getting this error message:

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment: 'UpdateSurvey'

/WorkSheet.asp, line 83

Line 83 or the worksheet is:
vSurveyID = objData.UpdateSurvey()

I'm passing the vSurveyID form another page example:

I know store and survey id are work becuase I able to import my data to the form it is just when I go back out to save the changes it is not passing the vSurveyID to it.

Any help would be great thanks in Advance.


If Request("SurveyID") <> "" Then

        vSurveyID = Request("SurveyID")

End If

ASP VBScript Code:

If Request.Form("action") = "Save Form Data" Then
    ' Do our DB insert!

        Dim objData
        Set objData = New clsUpdateData
        Dim vSurveyID

        Dim SurveyUpdateUser, SurveyUpdateDate,_
            AnswerGroupNumber, AnswerGroupWeight,_
            AnswerQuestionNumber, AnswerQuestionWeight,_
            AnswerValue, AnswerComment ' Dim Form Elements for writing to DB

        vSurveyID = objData.UpdateSurvey()

        SurveyUpdateUser = Request.ServerVariables("AUTH_USER")
        SurveyUpdateDate = FormatDateTime(Now(),0)

            For lGroup = 0 to oXml.SelectNodes("//root/group").Length - 1
                Set oGroup = oXml.SelectNodes("//root/group").Item(lGroup)

                For lQuestion = 0 to oGroup.SelectNodes("question").Length - 1
                    Set oQuestion = oGroup.SelectNodes("question").Item(lQuestion)

                        AnswerGroupNumber = Request.Form("AnswerGroupNumber_" & lGroup & "_" & lQuestion)
                        AnswerGroupWeight = Request.Form("AnswerGroupWeight_" & lGroup & "_" & lQuestion)
                        AnswerQuestionNumber = Request.Form("AnswerQuestionNumber_" & lGroup & "_" & lQuestion)
                        AnswerQuestionWeight = Request.Form("AnswerQuestionWeight_" & lGroup & "_" & lQuestion)
                        AnswerValue = Request.Form("AnswerValue_" & lGroup & "_" & lQuestion)
                        AnswerComment = Request.Form("AnswerComment_" & lGroup & "_" & lQuestion)

                        Call objData.UpdateAnswer( _
                            vSurveyID, _
                            0, _
                            AnswerGroupNumber, _
                            AnswerGroupWeight, _
                            AnswerQuestionNumber, _
                            AnswerQuestionWeight, _
                            AnswerValue, _
                            AnswerComment _

Class code:

Class clsUpdateData

        Dim objConn

        Private Sub Class_Initialize()
        End Sub

        Private Sub Class_Terminate()
        End Sub

        Public Function UpdateSurvey(pSurveyID) ' As Long

            Dim vSQL
            vSQL = Reusables.ReadAllFromFile(Server.MapPath("/lib/sql/clsData/UpdateSurvey.sql"))
            vSQL Replace(vSQL, "##pSurveyID##", "pSurveyID")

            Debug.PrintTA vSQL

            Set objRS = Server.CreateObject("ADODB.RecordSet")
            Call objRS.Open(vSQL, VZWApp.Setting("ConnectString"), adOpenKeyset, adLockOptimistic)

            With objRS

                    .Fields("SurveyUpdateDate") = Now()
                    .Fields("SurveyUpdateUser") = Request.ServerVariables("AUTH_USER")
                    .Fields("SurveyOutletID") = Request.Form("SurveyOutletID")

                UpdateSurvey = .Fields("SurveyID")

                Call .Close()

            End With

            Set objRS = Nothing

        End Function

        Public Function UpdateAnswer( _
            pSurveyID, _
            pFormVersionID, _
            pAnswerGroupNumber, _
            pAnswerGroupWeight, _
            pAnswerQuestionNumber, _
            pAnswerQuestionWeight, _
            pAnswerValue, _
            pAnswerComment _
            ) ' As Long

            Dim vSQL
            vSQL = Reusables.ReadAllFromFile(Server.MapPath("/lib/sql/clsData/UpdateAnswer.sql"))
            vSQL Replace(vSQL, "##pSurveyID##", "pSurveyID")

            Set objRS = Server.CreateObject("ADODB.RecordSet")
            Call objRS.Open(vSQL, VZWApp.Setting("ConnectString"), adOpenKeyset, adLockOptimistic)

            With objRS

                    .Fields("FormVersionID") = pFormVersionID
                    .Fields("AnswerGroupNumber") = pAnswerGroupNumber
                    .Fields("AnswerGroupWeight") = pAnswerGroupWeight
                    .Fields("AnswerQuestionNumber") = pAnswerQuestionNumber
                    .Fields("AnswerQuestionWeight") = pAnswerQuestionWeight
                    .Fields("AnswerValue") = pAnswerValue
                    .Fields("AnswerComment") = pAnswerComment

                AddAnswer = .Fields("AnswerID")

                Call .Close()

            End With

            Set objRS = Nothing

        End Function

    End Class

Old April 11th, 2007, 07:05 PM
Friend of Wrox
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41

You should look at the number of arguments in your function call. Have you googles this? There is so so so so much information on this very common error.

You even have 2 pages of results within this forums search:

Wind is your friend

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing ID query rsm42 ASP.NET 1.0 and 1.1 Basics 2 January 7th, 2007 10:45 AM
Passing the Id to another form louie001 ASP.NET 1.0 and 1.1 Basics 1 July 14th, 2006 06:45 AM
passing session Id via email ? Gotaka4 Pro PHP 2 March 30th, 2005 09:24 AM
Passing a variable into the id() function EstherMStrom XSLT 5 January 19th, 2005 02:32 PM
Multiple XML files matched with common Number Id gurbani XSLT 3 June 23rd, 2004 05:58 AM

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