ASP coding
#1
ASP coding
Can anyone help me with some ASP code.
I have a database which i have been able to write asp code to update my tables.
Adding data to the parent tables is working fine.
Cant seem to understand how i fill out a sub table where the primary key of the parent table is the foreign key in the child table.
For instance my userdetails table has a sub table of addresses as users can have many addresses.
the part of the code that seems to be failing that im using is:
set objRS = server.CreateObject ("ADODB.Recordset")
objRS.Open "StudentAddresses", strConnect, adOpenStatic, adLockOptimistic, adCmdTable
do while not objRS.EOF
if objRS("StudentID")=Sid Then
objRS("Address type")="home"
objRS("Street Address1")=Add1
objRS("Street Address2")=Add2
objRS("Town")=Town
objRS("City")=City
objRS("Country")=Coun
objRS("Post code")=Pcode
objRS("Property Phone Number")=pPhone
end if
objRS.MoveNext
loop
'Save record
objRS.Update
objRS.close
set objRS=nothing
Its really driving me crazy. well if anyone has any ideas..please please please let me know
Thanx
.<.MP.>.
I have a database which i have been able to write asp code to update my tables.
Adding data to the parent tables is working fine.
Cant seem to understand how i fill out a sub table where the primary key of the parent table is the foreign key in the child table.
For instance my userdetails table has a sub table of addresses as users can have many addresses.
the part of the code that seems to be failing that im using is:
set objRS = server.CreateObject ("ADODB.Recordset")
objRS.Open "StudentAddresses", strConnect, adOpenStatic, adLockOptimistic, adCmdTable
do while not objRS.EOF
if objRS("StudentID")=Sid Then
objRS("Address type")="home"
objRS("Street Address1")=Add1
objRS("Street Address2")=Add2
objRS("Town")=Town
objRS("City")=City
objRS("Country")=Coun
objRS("Post code")=Pcode
objRS("Property Phone Number")=pPhone
end if
objRS.MoveNext
loop
'Save record
objRS.Update
objRS.close
set objRS=nothing
Its really driving me crazy. well if anyone has any ideas..please please please let me know
Thanx
.<.MP.>.
#2
Scooby Regular
Join Date: Dec 2003
Location: cheshire
Posts: 1,180
Likes: 0
Received 0 Likes
on
0 Posts
MP,
good resources here:
www.aspin.com
What is the db & asp page gonna do?, may have something in my 'libary' you can adapt
PM me with more info
good resources here:
www.aspin.com
What is the db & asp page gonna do?, may have something in my 'libary' you can adapt
PM me with more info
Thread
Thread Starter
Forum
Replies
Last Post
Mattybr5@MB Developments
Full Cars Breaking For Spares
28
28 December 2015 11:07 PM
Mattybr5@MB Developments
Full Cars Breaking For Spares
12
18 November 2015 07:03 AM
Sam Witwicky
Engine Management and ECU Remapping
17
13 November 2015 10:49 AM