PDA

Click to See Complete Forum and Search --> : CAN ANYONE HELP ME PLEASE??is it possible


Johnny23
Feb 8th, 2001, 04:00 PM
how do i create a .asp within Ultradev
that inserts records into 2 of my tables when i click
on the submit button
ie
my text box fields on the details.asp are

UserFirstName
UserSurname
Email
ManagerName:
managersSurname:
EMail
ClientNAme
ClientSurname
Email

im using an SQL7 database
with the following TABLES and fields

USER
userid (primarykey)
managerID (foreignkey)
ClientID (foriegnkey)
UserFirstName
UserSurname
Email

MANAGER
MANAGERID (PrimaryKey)
ManagerName:
managersSurname:
EMail

CLIENT
Clientid (primarykey)
ClientNAme
ClientSurname
Email

i have been stuck on this for days i can insert a record into the user table but it will not allow me to insert into more then one TABLE per page and i have 3 tables i want to inserton on in this page

please help me out as im really really stuck
also
my ID Fields in my database all have primary keys set to
not allow nulls how do i get my form to increment these values
each value of
userid
managerid
clientid
as i insert more records?

im so verystuck and tried everything i can???
PLEASE
PLEASE
HELP ME OUT

Jerry Grant
Feb 8th, 2001, 04:43 PM
Ultradev? you mean Interdev?

Well you need to create SQL statements to insert a new record into each of the three tables.
A SQL statement can ony insert to one table at a time. so you will have to do 6 SQL statements.

Insert new record into MANAGER table
Select from MANAGER table to get MANAGERID
Insert new record into CLIENT table
Select from CLIENT table to get Clientid
Insert new record into USER table using selected MANAGERID & Clientid
Select from USER table to get userid to do further processing

This could be in a single stored procedure in the SQL server, though 3 would probably be simpler, due to the parameters which would need to be passed!
The three tables will need the primary key fields to have identity seeded fields, incrementing by 1. This will allow the fields to generate a unique number on every insert.
As you are doing this from ASP, do it with Server script. perhaps in a ActiveX.DLL, so to keep it neat.

Let me know how you get on, and if you need any more assistance :cool:

Johnny23
Feb 8th, 2001, 04:50 PM
thanks for that i will try that out and let you know
im using
dreamweaver ultradec not vb intradev though
thanks alot for all your help
cross my fingers it works!!