Question
SELECT @@IDENTITY question
How do i use the SELECT @@IDENTITY with the code below?
Andy
<%
'declare your variables
Dim firstname, lastname, company
Dim sConnString, connection, sSQL
'Receiving values from Form, assign the values entered to variables
firstname = Request("first_name")
lastname= Request("last_name")
company =Request("company")
'declare SQL statement that will query the database
sSQL = "INSERT into customers (firstname, lastname, companyname) values ('"
& firstname & "', '" & lastname & "', '" & company & "')"
'define the connection string, specify database
'driver and the location of database
sConnString="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\WebSite_folders\mysite\mydb.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(sSQL)
response.write "The form information was inserted successfully."
'Done. Close the connection object
connection.Close
Set connection = Nothing
%>
Andy
<%
'declare your variables
Dim firstname, lastname, company
Dim sConnString, connection, sSQL
'Receiving values from Form, assign the values entered to variables
firstname = Request("first_name")
lastname= Request("last_name")
company =Request("company")
'declare SQL statement that will query the database
sSQL = "INSERT into customers (firstname, lastname, companyname) values ('"
& firstname & "', '" & lastname & "', '" & company & "')"
'define the connection string, specify database
'driver and the location of database
sConnString="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\WebSite_folders\mysite\mydb.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(sSQL)
response.write "The form information was inserted successfully."
'Done. Close the connection object
connection.Close
Set connection = Nothing
%>
