AssetRecovery
Programmer
I have a current page that when I post my information from a form it writes a new record to my database. I like to create a page now that once the record is added it redirects me to that page and the same form that I used to post the new record is now populated with the new records information. Also I need it to have a button that if clicked it will take the values and update the database based on that record id. Here is my current code:
<% @ Language="VBScript" %>
<% Option Explicit %>
<%
'declare your variables
Dim accountnumber, lastname, firstname, ssn, dob, address, city, st, zip, phonenumber, area, employer, employeraddress, employerphone, cosigner, cosigneraddress, cosignerphone, spouse, pastdue, priorrepo, priordate, agency, agent, agencyphone, agentextension, agencyfax, vehicleyear, vehiclemake, vehiclemodel, vehiclecolor, vin, license, totalcharges, deliveredto, assigneddate, storagein, storageout, storagedays, repoagent, statuscode, accountstatus, ros, roc, cdb, othercollateral, dailynotes, housenotes
Dim sConnString, connection, sql_insert
' Receiving values from Form, assign the values entered to variables
accountnumber = Request.Form("accountnumber"
lastname = Request.Form("lastname"
firstname =Request.Form("firstname"
ssn =Request.Form("ssn"
dob =Request.Form("dob"
address =Request.Form("address"
city =Request.Form("city"
st =Request.Form("state"
zip =Request.Form("zip"
phonenumber =Request.Form("phonenumber"
area =Request.Form("area"
employer =Request.Form("employer"
employeraddress =Request.Form("employeraddress"
employerphone =Request.Form("employerphone"
cosigner =Request.Form("cosigner"
cosigneraddress =Request.Form("cosigneraddress"
cosignerphone =Request.Form("cosignerphone"
spouse =Request.Form("spouse"
pastdue =Request.Form("pastdue"
priorrepo =Request.Form("priorrepo"
priordate =Request.Form("priordate"
agency =Request.Form("agency"
agent =Request.Form("agent"
agencyphone =Request.Form("agencyphone"
agentextension =Request.Form("agentextension"
agencyfax =Request.Form("agencyfax"
vehicleyear =Request.Form("vehicleyear"
vehicleyear=Request.Form("vehicleyear"
vehiclemake =Request.Form("vehiclemake"
vehiclemodel =Request.Form("vehiclemodel"
vehiclecolor =Request.Form("vehiclecolor"
vin =Request.Form("vin"
license =Request.Form("license"
totalcharges =Request.Form("totalcharges"
deliveredto =Request.Form("deliveredto"
assigneddate =Request.Form("assigneddate"
storagein =Request.Form("storagein"
storageout =Request.Form("storageout"
storagedays =Request.Form("storagedays"
repoagent =Request.Form("repoagent"
statuscode =Request.Form("statuscode"
accountstatus =Request.Form("accountstatus"
ros =Request.Form("ros"
roc =Request.Form("roc"
cdb =Request.Form("cdb"
othercollateral =Request.Form("othercollateral"
dailynotes =Request.Form("dailynotes"
housenotes =Request.Form("housenotes"
'declare SQL statement that will query the database
sql_insert = "insert into repo (AccountNumber, LastName, FirstName, Address, City, State, Zip, Area, AccountStatus, SSN, DOB, PhoneNumber, Spouse, Employer, EmployerAddress, EmployerPhone, CoSigner, CosignerAddress, CosignerPhone, PastDue, PriorRepo, PriorDate, ROS, ROC, CDB, VehicleYear, VehicleMake, VehicleModel, VehicleColor, VIN, License, Agency, Agent, AgencyPhone, AgentExtension, AgencyFax, AssignedDate, TotalCharges, DeliveredTo, StorageIn, StorageOut, StorageDays, RepoAgent, StatusCode, OtherCollateral, DailyNotes, HouseNotes) values ('" & accountnumber & "', '" & lastname & "', '" & firstname & "', '" & address & "', '" & city & "', '" & st & "', '" & zip & "', '" & area & "', '" & accountstatus & "', '" & ssn & "', '" & dob & "', '" & phonenumber & "', '" & spouse & "', '" & employer & "', '" & employeraddress & "', '" & employerphone & "', '" & cosigner & "', '" & cosigneraddress & "', '" & cosignerphone & "', '" & pastdue & "', '" & priorrepo & "', '" & priordate & "', '" & ros & "', '" & roc & "', '" & cdb & "', '" & vehicleyear & "', '" & vehiclemake & "', '" & vehiclemodel & "', '" & vehiclecolor & "', '" & vin & "', '" & license & "', '" & agency & "', '" & agent & "', '" & agencyphone & "', '" & agentextension & "', '" & agencyfax & "', '" & assigneddate & "', '" & totalcharges & "', '" & deliveredto & "', '" & storagein & "', '" & storageout & "', '" & storagedays & "', '" & repoagent & "', '" & statuscode & "', '" & othercollateral & "', '" & dailynotes & "', '" & housenotes & "')"
'define the connection string, specify database
'driver and the location of database
sConnString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("data/repo_2002.mdb" & ";"
'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection"
'Open the connection to the database
connection.Open(sConnString)
'execute the SQL
connection.execute(sql_insert)
' Done. Close the connection object
connection.Close
Set connection = Nothing
response.redirect "viewform.asp"
%>
<% @ Language="VBScript" %>
<% Option Explicit %>
<%
'declare your variables
Dim accountnumber, lastname, firstname, ssn, dob, address, city, st, zip, phonenumber, area, employer, employeraddress, employerphone, cosigner, cosigneraddress, cosignerphone, spouse, pastdue, priorrepo, priordate, agency, agent, agencyphone, agentextension, agencyfax, vehicleyear, vehiclemake, vehiclemodel, vehiclecolor, vin, license, totalcharges, deliveredto, assigneddate, storagein, storageout, storagedays, repoagent, statuscode, accountstatus, ros, roc, cdb, othercollateral, dailynotes, housenotes
Dim sConnString, connection, sql_insert
' Receiving values from Form, assign the values entered to variables
accountnumber = Request.Form("accountnumber"
lastname = Request.Form("lastname"
firstname =Request.Form("firstname"
ssn =Request.Form("ssn"
dob =Request.Form("dob"
address =Request.Form("address"
city =Request.Form("city"
st =Request.Form("state"
zip =Request.Form("zip"
phonenumber =Request.Form("phonenumber"
area =Request.Form("area"
employer =Request.Form("employer"
employeraddress =Request.Form("employeraddress"
employerphone =Request.Form("employerphone"
cosigner =Request.Form("cosigner"
cosigneraddress =Request.Form("cosigneraddress"
cosignerphone =Request.Form("cosignerphone"
spouse =Request.Form("spouse"
pastdue =Request.Form("pastdue"
priorrepo =Request.Form("priorrepo"
priordate =Request.Form("priordate"
agency =Request.Form("agency"
agent =Request.Form("agent"
agencyphone =Request.Form("agencyphone"
agentextension =Request.Form("agentextension"
agencyfax =Request.Form("agencyfax"
vehicleyear =Request.Form("vehicleyear"
vehicleyear=Request.Form("vehicleyear"
vehiclemake =Request.Form("vehiclemake"
vehiclemodel =Request.Form("vehiclemodel"
vehiclecolor =Request.Form("vehiclecolor"
vin =Request.Form("vin"
license =Request.Form("license"
totalcharges =Request.Form("totalcharges"
deliveredto =Request.Form("deliveredto"
assigneddate =Request.Form("assigneddate"
storagein =Request.Form("storagein"
storageout =Request.Form("storageout"
storagedays =Request.Form("storagedays"
repoagent =Request.Form("repoagent"
statuscode =Request.Form("statuscode"
accountstatus =Request.Form("accountstatus"
ros =Request.Form("ros"
roc =Request.Form("roc"
cdb =Request.Form("cdb"
othercollateral =Request.Form("othercollateral"
dailynotes =Request.Form("dailynotes"
housenotes =Request.Form("housenotes"
'declare SQL statement that will query the database
sql_insert = "insert into repo (AccountNumber, LastName, FirstName, Address, City, State, Zip, Area, AccountStatus, SSN, DOB, PhoneNumber, Spouse, Employer, EmployerAddress, EmployerPhone, CoSigner, CosignerAddress, CosignerPhone, PastDue, PriorRepo, PriorDate, ROS, ROC, CDB, VehicleYear, VehicleMake, VehicleModel, VehicleColor, VIN, License, Agency, Agent, AgencyPhone, AgentExtension, AgencyFax, AssignedDate, TotalCharges, DeliveredTo, StorageIn, StorageOut, StorageDays, RepoAgent, StatusCode, OtherCollateral, DailyNotes, HouseNotes) values ('" & accountnumber & "', '" & lastname & "', '" & firstname & "', '" & address & "', '" & city & "', '" & st & "', '" & zip & "', '" & area & "', '" & accountstatus & "', '" & ssn & "', '" & dob & "', '" & phonenumber & "', '" & spouse & "', '" & employer & "', '" & employeraddress & "', '" & employerphone & "', '" & cosigner & "', '" & cosigneraddress & "', '" & cosignerphone & "', '" & pastdue & "', '" & priorrepo & "', '" & priordate & "', '" & ros & "', '" & roc & "', '" & cdb & "', '" & vehicleyear & "', '" & vehiclemake & "', '" & vehiclemodel & "', '" & vehiclecolor & "', '" & vin & "', '" & license & "', '" & agency & "', '" & agent & "', '" & agencyphone & "', '" & agentextension & "', '" & agencyfax & "', '" & assigneddate & "', '" & totalcharges & "', '" & deliveredto & "', '" & storagein & "', '" & storageout & "', '" & storagedays & "', '" & repoagent & "', '" & statuscode & "', '" & othercollateral & "', '" & dailynotes & "', '" & housenotes & "')"
'define the connection string, specify database
'driver and the location of database
sConnString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("data/repo_2002.mdb" & ";"
'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection"
'Open the connection to the database
connection.Open(sConnString)
'execute the SQL
connection.execute(sql_insert)
' Done. Close the connection object
connection.Close
Set connection = Nothing
response.redirect "viewform.asp"
%>