473,320 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

SELECT SCOPE_IDENTITY() problems

Hi,

I'm having trouble getting this ASP code to work. I want to retrieve the record just added, and found the scope_identity() syntax, but I get the following error:

Microsoft JET Database Engine error '80040e14'

Characters found after end of SQL statement.

Original code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Query = "INSERT INTO tbl_requests([id], [from], [days], [requested], [manager]) VALUES ('" & Session("id") & "','" & request("date_from") & "','" & request("date_days") & "','" & date() & "','" & request("manager") & "'); SELECT SCOPE_IDENTITY();"
  3.  
  4. kbRS.Open Query, strConn, adOpenStatic, adLockOptimistic
  5.  
Thanks in advance for anyone's help!

T
Aug 7 '07 #1
2 5422
omerbutt
638 512MB
thats probably because you are using insert and select i the same statement why not you run a separate query for checking the last inserted values
May 3 '08 #2
DrBunchman
979 Expert 512MB
Hi tslorick,

I expect the problem here is you are trying to batch several commands which cannot be done with some databases. Can you confirm which database you are using?

Dr B
May 5 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Christopher Brandsdal | last post by:
Hi! I am having some problems width a little script i downloaded... I'm not able to figure out what he SELECT line does! What does the @@identity mean? Is this maby a javascript? :)
5
by: Rick | last post by:
I want to write a single sp where I pass in the column values and if it finds an exact match it returns the refid of that match else if it doesn't find it, it adds a new row using the passed in...
5
by: Larry | last post by:
I am seeing a problem with an ASP application, where I have 2 tables. In the first table, the ASP inserts just 1 row and retrieves the primary key of the new row using SCOPE_IDENTITY. It then uses...
0
by: avinashraj | last post by:
Hi All, I need to run a compound SQL statement involving a insert into followed by a select into statement from a ADO.NET command object. The insert into inserts the record while the select into...
2
by: Banski | last post by:
Hi, Im trying to use SELECT @@IDENTITY in a transaction. But it always returns 0. Im using an ms access database. And using the following code. What am i doing wrong? Best regards banski ...
7
by: Brian | last post by:
Hello all - I am trying to Insert a new record to an Access 2002 database. Following the insert, I need to obtain the primary key of the inserted row (person_ID) which is an Autonumber field. I...
1
by: Justyn | last post by:
Hi everyone, I hope someone can help me out! I have added a trigger that gets fired on INSERT and which itself inserts data into another table WITHOUT an identity I used to get back the...
13
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table...
0
by: tslorick | last post by:
Hi, I'm having trouble getting this ASP code to work. I want to retrieve the record just added, and found the scope_identity() syntax, but I get the following error: Microsoft JET Database...
3
by: Miro | last post by:
I am trying to get my ID added from a people table in an access table "MyContacts.mdb" i just added. Its basically a contact file i created in access: PK Person_ID - Unique - autoincrement...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.