A
Andrew Poulos
From http://databases.aspfaq.com I got this bit of ASP code for getting
the identity value for a row inserted into an MS Access database:
<%
fakeValue = 5
set conn = CreateObject("ADODB.Connection")
conn.open "<conn string>"
sql = "INSERT someTable(IntColumn) VALUES(" & fakeValue & ")" & _
VBCrLf & " SELECT @@IDENTITY"
set rs = conn.execute(sql)
response.write "New ID was " & rs(0)
rs.close: set rs = nothing
conn.close: set conn = nothing
%>
I write ASP using JavaScript and converting the sql string to
sql = "INSERT someTable(IntColumn) VALUES(" + fakeValue + ")";
sql += "\r\n SELECT @@IDENTITY";
gives me an error that the SQL statement doesn't end in a semi colon. If
I add a semicolon to the end of the first SQL statement I get an error
that there are additional characters after the SQL statement.
Is there a way to get this to work or is aspfaq.com mistaken that you
can run multiple SQL statements on an MS Access database?
Andrew Poulos
the identity value for a row inserted into an MS Access database:
<%
fakeValue = 5
set conn = CreateObject("ADODB.Connection")
conn.open "<conn string>"
sql = "INSERT someTable(IntColumn) VALUES(" & fakeValue & ")" & _
VBCrLf & " SELECT @@IDENTITY"
set rs = conn.execute(sql)
response.write "New ID was " & rs(0)
rs.close: set rs = nothing
conn.close: set conn = nothing
%>
I write ASP using JavaScript and converting the sql string to
sql = "INSERT someTable(IntColumn) VALUES(" + fakeValue + ")";
sql += "\r\n SELECT @@IDENTITY";
gives me an error that the SQL statement doesn't end in a semi colon. If
I add a semicolon to the end of the first SQL statement I get an error
that there are additional characters after the SQL statement.
Is there a way to get this to work or is aspfaq.com mistaken that you
can run multiple SQL statements on an MS Access database?
Andrew Poulos