Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: cannot addnew in multiple recordsets


Message #1 by "wayne wanless" <wanless@n...> on Wed, 19 Feb 2003 19:21:53
I am receiving an error when I try to run the code below (all error 
checking, etc has been removed for brevity):


what am I missing?
----------------------------------------------------

<% @ Language = "VBScript"%>

<%
Dim strconn
Dim sEquipType
Dim rs
Dim rs1
Dim rs2


Call Intializevariables()

'set a local variable to my DSN-less connection String
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath
("instbaseusa.mdb")

'Create the Connection object
set conn = server.createobject("adodb.connection")
conn.open strconn
set rs = server.createobject("adodb.recordset")
set rs1 = server.createobject("adodb.recordset")
set rs2 = server.createobject("adodb.recordset")

Call AddCustInfo()
Call AddTransInfo()

sEquipType = Request.form("group1")
Select Case sEquipType
Case "Classic"
        Call AddClassicInfo()
Case "V2"
        Call AddV2Info()
Case "LDR"
        Call AddLDRInfo()


' ---------------------------------------------'

Private Sub initializeVariables()

        strconn = ""
        sEquipType = ""
        rs = ""                ' record customer information
        rs1 = ""        ' record equipment information
        rs2 = ""        ' record transaction information

End Sub

' --------------------------------------------- '
Private Sub AddCustInfo()

rs.open "current_customers", conn, 2, 2

rs.addnew        'Use the addnew method of the recordset object to add a 
record

        rs("hospital_ID") = request.form("custnumber")
        rs("Hospital_name") = request.form("hospname")
        rs("Street1") = request.form("hospaddress")
        rs("City") = request.form("hospCity")
        rs("State") = request.form("hospState")
        rs("Zip") = request.form("hospZip")
        rs("Main_Contact_Name") = request.form("mainContactName")
        rs("Main_Contact_Phone") = request.form("mainContactTelephone")
        rs("Main_Contact_Fax") = request.form("mainContactFax")
        rs("Main_Contact_Email") = request.form("mainContactEmail")
        rs("Sec_Contact_Name") = request.form("secContactName")
        rs("Sec_Contact_Phone") = request.form("secContactTelephone")
        rs("Sec_Contact_Fax") = request.form("secContactFax")
        rs("Sec_Contact_Email") = request.form("secContactEmail")
rs.update
rs.movelast

End Sub

' -------------------------------------------------------------- '
Private Sub AddClassicInfo()

rs1.open "afterloaders", conn, 2, 2

rs1.addnew

        rs1("ALType") = request.form("group1")
        rs1("Serial") = request.form("menu1a")
        rs1("SW_Revision") = request.form("menu2a")
        rs1("Board_Rev") = request.form("menu3a")
        rs1("Rev_TU_CPU") = request.form("menu4a")
        rs1("Rev_TCU_CPU") = request.form("menu5a")
        rs1("Type_TU_CPU") = request.form("menu6a")
        rs1("Type_TCU_CPU") = request.form("menu7a")
        rs1("Program_Card_Type") = request.form("menu8a")
        rs1("Computer_Type") = request.form("menu9a")
        rs1("EMC") = request.form("menu10a")
        rs1("Motor_Drivers") = request.form("menu11a")
        rs1("Opto_Blocks") = request.form("menu12a")
        rs1("Cable_Guides") = request.form("menu13a")
        rs1("Safe_Size") = request.form("menu14a")
        rs1("Data_Cable_Length") = request.form("menu15a")
        rs1("E_Clutch") = request.form("menu16a")
        rs1("Batt_Prot_CKT") = request.form("menu17a")
rs1.update
rs1.movelast

End Sub

' --------------------------------------------------------------- '
Private Sub AddV2Info()

rs1.open "Afterloaders", conn, 2, 2

rs1.addnew

        rs1("ALType") = request.form("group1")
        rs1("Serial") = request.form("menu1b")
        rs1("SW_Rev_TU") = request.form("menu2ba")
        rs1("SW_Rev_TCS") = request.form("menu2bb")
        rs1("SW_Rev_TCP") = request.form("menu2bc")
        rs1("Board_Rev") = request.form("menu3b")
        rs1("Opto_IF") = request.form("menu4b")
        rs1("Junction_Box") = request.form("menu5b")
        rs1("Computer_Type") = request.form("menu6b")
        rs1("Transportable") = request.form("menu7b")
        rs1("Back_Up") = request.form("menu8b")
        rs1("Printer_Type") = request.form("menu9b")
        rs1("Printer_Network") = request.form("menu10b")
        rs1("Network") = request.form("menu11b")
        rs1("Data_Cable_Length") = request.form("menu12b")
rs1.update

rs1.movelast

End Sub

' --------------------------------------------------------------- '
Private Sub AddLDRInfo()

rs1.open "Afterloaders", conn, 2, 2

rs1.addnew

        rs1("ALType") = request.form("group1")
        rs1("Serial") = request.form("menu1c")
        rs1("SW_Revision") = request.form("menu2c")
        rs1("Num_Chans") = request.form("menu3c")
        rs1("EMC") = request.form("menu4c")
        rs1("Nurse") = request.form("menu5c")
        rs1("Air") = request.form("menu6c")
        rs1("Compressor") = request.form("menu7c")
        rs1("Comp_Filter") = request.form("menu8c")
        rs1("Treat_Tube_Len_1") = request.form("menu9ca")
        rs1("Treat_Tube_Len_2") = request.form("menu9cb")
        rs1("SRC_Xfer_Counter") = request.form("menu10c")
        rs1("Num_Sources") = request.form("menu11c")
        rs1("Power_Supply") = request.form("menu12c")
        rs1("Printer_Type") = request.form("menu13c")
        rs1("Card_Reader") = request.form("menu14c")

rs1.update

rs1.movelast

End Sub

' --------------------------------------------------------------- '
Private Sub AddTransInfo()

rs2.open "Transaction", conn, 2, 2

rs2.addnew

        rs2("call_number") = request.form("callnumber")
        rs2("date") = request.form("transdate")
        rs2("Engineer_ID") = request.form("engineer")

rs2.update

rs2.movelast

End Sub


%>


<%
rs.close
rs1.close
rs2.close
set rs= nothing
set rs1= nothing
set rs2= nothing
set conn = nothing

Response.redirect"afterloader.htm"
%>
Message #2 by "Ken Schaefer" <ken@a...> on Thu, 20 Feb 2003 10:54:06 +1100
: I am receiving an error when I try to run the code below 

...and what is the error?

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "wayne wanless" <wanless@n...>
Subject: [access_asp] cannot addnew in multiple recordsets


: I am receiving an error when I try to run the code below (all error 
: checking, etc has been removed for brevity):
: 
: 
: what am I missing?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "wayne wanless" <wanless@n...> on Thu, 20 Feb 2003 14:19:38
> : I am receiving an error when I try to run the code below 

...and what is the error?

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "wayne wanless" <wanless@n...>
Subject: [access_asp] cannot addnew in multiple recordsets


: I am receiving an error when I try to run the code below (all error 
: checking, etc has been removed for brevity):
: 
: 
: what am I missing?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #4 by "wayne wanless" <wanless@n...> on Thu, 20 Feb 2003 14:25:34
Ken,
I am receiving an http 500 internal server error (IE). I have tried 
passing the form information (FORM ACTION = BLAHBLAH.ASP) and I have tried 
combining the VBScript code with the form (i.e. using one file instead of 
two).

I have successfully accessed one table in the database with similar code, 
so I know the form and DB will work, but I have been unsuccessful in 
getting the form to access multiple tables.

Thanks for your help.
Wayne 



> : I am receiving an error when I try to run the code below 

...and what is the error?

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "wayne wanless" <wanless@n...>
Subject: [access_asp] cannot addnew in multiple recordsets


: I am receiving an error when I try to run the code below (all error 
: checking, etc has been removed for brevity):
: 
: 
: what am I missing?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #5 by "Ken Schaefer" <ken@a...> on Fri, 21 Feb 2003 12:06:52 +1100
In Internet Explorer, please goto Tools -> Internet Options -> Advanced and
uncheck the box that says "Show Friendly HTTP Errors". Refresh the page, and
post the real error message.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "wayne wanless" <wanless@n...>
Subject: [access_asp] Re: cannot addnew in multiple recordsets


: Ken,
: I am receiving an http 500 internal server error (IE). I have tried
: passing the form information (FORM ACTION = BLAHBLAH.ASP) and I have tried
: combining the VBScript code with the form (i.e. using one file instead of
: two).
:
: I have successfully accessed one table in the database with similar code,
: so I know the form and DB will work, but I have been unsuccessful in
: getting the form to access multiple tables.
:
: Thanks for your help.
: Wayne
:
:
:
: > : I am receiving an error when I try to run the code below
:
: ...and what is the error?
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "wayne wanless" <wanless@n...>
: Subject: [access_asp] cannot addnew in multiple recordsets
:
:
: : I am receiving an error when I try to run the code below (all error
: : checking, etc has been removed for brevity):
: :
: :
: : what am I missing?
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message #6 by "wayne wanless" <wanless@n...> on Fri, 21 Feb 2003 03:05:10
Ken,
Thank you for the suggestion; I did this and discovered the real culprit-
bad database design!!! Two of the tables had relationship issues; when IE 
gives the real error (as opposed to the friendly error), it becomes a lot 
clearer.

Again, thank you very much for your help.
Best Regards,
Wayne

> In Internet Explorer, please goto Tools -> Internet Options -> Advanced 
and
uncheck the box that says "Show Friendly HTTP Errors". Refresh the page, 
and
post the real error message.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "wayne wanless" <wanless@n...>
Subject: [access_asp] Re: cannot addnew in multiple recordsets


: Ken,
: I am receiving an http 500 internal server error (IE). I have tried
: passing the form information (FORM ACTION = BLAHBLAH.ASP) and I have 
tried
: combining the VBScript code with the form (i.e. using one file instead of
: two).
:
: I have successfully accessed one table in the database with similar code,
: so I know the form and DB will work, but I have been unsuccessful in
: getting the form to access multiple tables.
:
: Thanks for your help.
: Wayne
:
:
:
: > : I am receiving an error when I try to run the code below
:
: ...and what is the error?
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "wayne wanless" <wanless@n...>
: Subject: [access_asp] cannot addnew in multiple recordsets
:
:
: : I am receiving an error when I try to run the code below (all error
: : checking, etc has been removed for brevity):
: :
: :
: : what am I missing?
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  Return to Index