Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > IDENTITY, Access, and multiple SQL statements

Thread Tools

IDENTITY, Access, and multiple SQL statements

Andrew Poulos
Posts: n/a
From 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 string>"
sql = "INSERT someTable(IntColumn) VALUES(" & fakeValue & ")" & _
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 mistaken that you
can run multiple SQL statements on an MS Access database?

Andrew Poulos
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
if statements and case statements questions John Crichton Ruby 6 07-12-2010 06:17 PM
Prepare Statements VS Statements Vince Java 12 01-21-2008 01:18 PM
component statements within architecture statements Neil Zanella VHDL 8 10-20-2006 09:05 AM
send batch of sql statements to sql server JT ASP General 1 09-27-2005 10:07 PM
if statements with or w/o else statements Harry George Python 6 02-23-2004 06:48 PM