Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 11th, 2007, 11:30 AM
Authorized User
 
Join Date: Jan 2007
Location: , , USA.
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:
WorkSheet.asp?Store=1234&SurveyID=226

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.

Jonsey


Code:
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 _
                            )
            Next
        Next


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

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

                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

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

                AddAnswer = .Fields("AnswerID")

                Call .Close()

            End With

            Set objRS = Nothing

        End Function



    End Class




Reply With Quote
  #2 (permalink)  
Old April 11th, 2007, 07:05 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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:
http://p2p.wrox.com/search.asp?mode=...gnment&x=9&y=9

Wind is your friend
Matt
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:52 AM.


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