IDENTITY, Access, and multiple SQL statements
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
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?
|All times are GMT. The time now is 10:21 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.