Updating a record

This is a discussion on "Updating a record" within the Classic ASP section. This forum, and the thread "Updating a record are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jun 3rd, 2007, 06:56
Junior Member
Join Date: Feb 2007
Location: Crowborough UK
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Updating a record

Hi I am new to ASP and have a problem updating a record in my db.

The error is:
Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

And the code is:
Code: Select all
 <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<!--#include file="sqlconn.asp"-->

<%
'Constants ripped from adovbs.inc:
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = &H0001

dim strSearchStudId
dim strSearchSurname
dim strSearchForename
dim strSQL

'populate variables if anything was passed from the submitted form
strSearchStudId = Request.QueryString("id")
strSearchSurname = Request.QueryString("surname")
strSearchForename = Request.QueryString("forename")

'Create connection object
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open conn2

'Get setup table information
strSQL = "SELECT * FROM setup" 
Set rsSetup = Server.CreateObject("ADODB.Recordset")
rsSetup.Open strSQL, cn, 1, 3, adCmdText

if request.QueryString("action") = "add" then

    'Handle any additions/edits before populating the grid
    if request.form("DoSubmit") = "True" and request.Form("num_student_college_sub_total") > 0 then
    
        strSQL = "INSERT INTO paymentAdd " & _
"(student_id, acadyear, tuition, collegetotalpay, collegetotal, added, who_added, updated, who_updated) " & _
                    "VALUES (" & _
                    "'" & Request.QueryString("id") & "', '" & _
                    rsSetup("acadyear") & "', " & _
                    FormatCurrency(request.Form("num_tuition")) & ", '" & _
                    request.Form("college_total") & "', " & _
                    FormatCurrency(request.Form("num_student_college_sub_total")) & ", " & _         
                    "Convert(DateTime, GETDATE(), 103), " & _                                           
"'" & session("Name") & "', " & _ 
                    "Convert(DateTime, GETDATE(), 103), " & _                                              
"'" & session("Name") & "');" 
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open strSQL, cn, 1, 3, adCmdText
        
    end if
end if

if request.QueryString("action") = "release" then
    strSQL = "UPDATE paymentAdd Set " & _
                        "collegetotalpay" = "Yes"  & " , " &_
"WHERE id= '" & request.QueryString("rid") & "' AND student_id = '" & request.QueryString("id") & "';"
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open strSQL, cn, 1, 3, adCmdText

end if

if request.QueryString("action") = "delete" then

    strSQL = "DELETE FROM paymentAdd WHERE id = '" & request.QueryString("rid") & "';"
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open strSQL, cn, 1, 3, adCmdText
        
end if


response.Redirect("payment_scheduleAdditionsSimple.asp?id=" & strSearchStudId & "&surname=" & strSearchSurname & "&forename=" & strSearchForename) 

%>


I am not sure but do I have to first loop through checking for a record in order to do an update - could that be why it is not working?

Many thanks for any help.

Last edited by Wheatus7; Jun 3rd, 2007 at 07:13. Reason: Want to put the code in a separate window
Reply With Quote

Reply

Tags
update statement

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
record keeping karmaman E-Commerce and Business 1 Sep 19th, 2007 10:45
Record videos on your pc Pádraig Webforumz Cafe 10 May 2nd, 2007 19:04
displaying or updating a record from a list Colm Osiris Databases 2 Feb 13th, 2006 13:45
updating mysql record djme Databases 4 Jan 4th, 2006 23:09
insert record accessman Databases 1 Oct 15th, 2005 01:12


All times are GMT. The time now is 10:07.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43