<%
Dim rsIDValue, message
Sub getRecordSet
Dim conn, command, connection
command = "INSERT INTO tbl_customers (cst_FirstName, cst_Surname, cst_Address1, cst_Address2, cst_County, cst_Postcode, cst_Phone, cst_Email, cst_Agreement) VALUES ('"&Request.form("textFirstName")&"','"&Request.form("textSurname")&"','"&Request.form("textAddress1")&"','"&Request.form("textAddress2")&"','"&Request.form("textCounty")&"','"&Request.form("textPostcode")&"','"&Request.form("textPhone")&"','"&Request.form("textEmail")&"','"&Request.form("textAgreement")&"')"
on error resume next
' Create an ActiveX Data Object for the database connection
Set conn = Server.CreateObject("ADODB.Connection")
if err then
Response.Write "There was an error with adodb connection " & vbLF
'* developer only * Response.Write err.number & " " & err.description & " " & err.source
Response.End
else
connection = "********"
' Try to open a connection to the database
conn.open connection
if err then
Response.Write "There was an error opening the database connection string " & vbLF
'* developer only * Response.Write err.number & " " & err.description & " " & err.source
Response.End
else
' For MS SQL comment out next two lines
conn.execute(command)
command="SELECT @@IDENTITY;"
Set rsIDValue = conn.execute(command)
if err then
Response.Write "There was an error opening the recordset to retrieve the requested data. " & vbLF
'* developer only * Response.Write err.number & " " & err.description & " " & err.source
Response.End
else
' we have our recordset or results, lets go.
Exit Sub
end if
set rsIDValue = nothing
conn.close
end if
Set conn = nothing
end if
on error goto 0
End Sub
call getRecordSet()
' Was the subroutine successful? (Did we get a recordset object)
if isObject(rsIDValue) then
' And do we have records?
if NOT (rsIDValue.bof AND rsIDValue.eof) then
if err then
Response.Write "There is no record to write to child table. " & vbLF
'* developer only * Response.Write err.number & " " & err.description & " " & err.source
Response.End
else
end if
message = rsIDValue(0)
Dim conn, command, connection
command = "INSERT INTO tbl_customerforms ( (frmCustID is the field which requires the value), frm_FormID, frm_WebID, frm_Branch, frm_EnquiryDate, frm_CustComm) VALUES ('"&Request.form("textFormID")&"','"&Request.form("textWebID")&"','"&Request.form("textBranch")&"','"&Request.form("textEnquiryDate")&"','"&Request.form("textCustComm")&"')"
on error resume next
' Create an ActiveX Data Object for the database connection
Set conn = Server.CreateObject("ADODB.Connection")
if err then
Response.Write "There was an error with adodb connection " & vbLF
'* developer only * Response.Write err.number & " " & err.description & " " & err.source
Response.End
else
connection = "******"
' Try to open a connection to the database
conn.open connection
if err then
Response.Write "There was an error opening the database connection string " & vbLF
'* developer only * Response.Write err.number & " " & err.description & " " & err.source
Response.End
else
' For MS SQL comment out next two lines
conn.execute(command)
end if
end if
rs.close ()
Set rs = nothing
end if
end if
%>
|