Hello,
This is simple I know, but I am have an issue when trying to insert data into a SQL DB.
I am collecting data from a user and then inserting the data.
I think I am connecting to the DB correctly but I can seem to add the records.
Thanks for the help
This is simple I know, but I am have an issue when trying to insert data into a SQL DB.
I am collecting data from a user and then inserting the data.
I think I am connecting to the DB correctly but I can seem to add the records.
Thanks for the help
Code:
<%
firstName=Request.Form("Fname")
LastName=Request.Form("Lname")
DateOfBirth =Request.Form("dob")
HomePhone =Request.Form("homePhone")
dim connectionString
connectionString="PROVIDER=MSDASQL ;DRIVER={SQL Server};"
connectionString = connectionString & "SERVER=xx.xx.xx.xx; DATABASE=xxxxxxx;"
connectionString = connectionString & "UID=xxxxxxx; PWD=xxxxxxx;"
dim sqlCode
sqlCode="INSERT INTO ContactRequests(FirstName,LastName,DateOfBirth,HomePhone)"
sqlCode=sqlCode & "VALUES"
sqlCode=sqlCode &"(firstName)"
sqlCode=sqlCode &"(LastName)"
sqlCode=sqlCode &"(DateOfBirth)"
sqlCode=sqlCode &"(HomePhone)"
dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open connectionString
dim recordSet1
SET recordSet1 = Conn.Execute(sqlCode)
Response.Redirect "completed.html"
%>