how to get inserted row id

Hi, 

I have a table where id is primary key and autonumber. When I insert record to this table I need to get this id. in MSSQL it is very easy to achive with @@Identity feature. But how can I achive similar effect in access db.
Ireland's classifieds | UK classifieds
0
Skiff
5/8/2004 11:12:28 AM
asp.net.access-datasource 4679 articles. 0 followers. Follow

1 Replies
595 Views

Similar Articles

[PageSpeed] 52

The same way.

http://support.microsoft.com/?id=232144 INFO: Jet OLE DB Provider Version 4.0 Supports SELECT @@Identity
Cheers
Ken
0
Ken
5/8/2004 3:09:53 PM
Reply:

Similar Artilces:

FormView Insert Operation
How can I get the ID - the primary key - of the newly inserted row when adding anew record to the database using a FormView Control on a web page?I need the ID to store data in a related table. I'm not using stored procedures. Sure you can. Here's an example using a SqlDataSource. Pay attention to the usage of the ouptut parameter. ASPX <asp:label id="lblMessage" runat="server" /><br /> <br /> <asp:formview id="fvDepartment" runat="server" defaultmode="Insert" datakeynames="DepartmentID" datasourceid="sdsDepartment"> <insertitemtemplate> Nam...

Get the last inserted row's Identity (ID) using DataTable and Row
 hiI use DataTable and Row and the Update() method to insert data into my table.I need to retrieve the Identity (ID) assigned to that row for further processing. (e.g. add data into other tables that refer to this row).How do I retrieve the ID?  In a high traffic website (e.g. 100 inserts in 5 seconds), by just retrieving the ID of the last inserted row may not be very safe. Please advise if I am correct.Any other methods of achieving the same goal?thanks in advance  string query = "Insert Into yourTableName("col1","col2") values(xyz,pqr) select...

Need to get row id after insert. Can't get my syntax working.
 Hi,I'm trying to get the identity of the row after an insert, but I can't get the syntax right.  Could someone with better eyeballs help me out? Here is my Insert stuff..  <asp:SqlDataSource ID="SqlDataSourceQueue" runat="server" ConnectionString="<%$ ConnectionStrings:ServiceQConnectionString %>" SelectCommand="SELECT * FROM [queue] WHERE ([caseno] = @caseno)" DeleteCommand="DELETE FROM [queue] WHERE [id] = @id" InsertCommand="INSERT INTO queue (caseno...

SqlDataSource with Access database: how to get back the latest inserted record Id after Inserting a new record
Hi all, Y use an Access database with a password. That´s the reason why I use the SqlDataSource. Works very good!But, I have bad luck in getting back the latest inserted record Id after Inserting a new record. I use the DetailsView. An SqlDataSource is bound to a TextBox that should represent the IdCliente.So, after inserting the Client details I want to have back the IdCliente to show the Client details inserted.I have read many of your greatfull help about getting back the latest inserted record Id after Inserting a new record.I used your good ideas: INSERT INTO [T_Clientes...

how I can get last inserted row in triggre After Insert Row.
Hello all , I written one trigger After row Insert now i want to update some column after row insert but please tell me how i can get last inserted row (last immediately inserted row) so that i can immidiatly Update the row. my trigger is here : ALTER TRIGGER Uldefaultvalue AFTER INSERT ORDER 1 ON "DBA"."style" REFERENCING NEW AS u FOR EACH ROW /* WHEN ( search-condition ) */ BEGIN Declare an_id numeric(9,2) ; select s_id into an_id from style ; update style set customer = 'cust' where s_id = an_id ; END here it is giving err...

Inserting 1 row and getting a message that two rows were inserted.
Why does this code tell me that I inserted 2 rows when I really only inserted one? I am using SQL server 2005 Express. I can open up the table and there is only one record in it. Dim InsertSQL As String = "INSERT INTO dbCG_Disposition ( BouleID, UserName, CG_PFLocation ) VALUES ( @BouleID, @UserName, @CG_PFLocation )"Dim Status As Label = lblStatus Dim ConnectionString As String = WebConfigurationManager.ConnectionStrings("HTALNBulk").ConnectionString Dim con As New SqlConnection(ConnectionString) Dim cmd As New SqlCommand(InsertSQL, con)...

Getting id of last row inserted.
I am using MS Access as database and want to retrieve the id of the last row inserted by current user. Please note, the system can be accessed by multiple user at same time.   Any help ??  See http://www.mikesdotnetting.com/Article.aspx?ArticleID=54Mike: I am learning :)If this post was useful to you, please mark it as answer. Thank you! Thanks for the help. But, I am using TableAdapters. Any help.  http://forums.microsoft.com/msdn/ShowPost.aspx?siteid=1&PostID=58862 Regards Mike [MVP - ASP/ASP.NET]My site...

How do I get the row id of the last insert?
If I insert a row into mySQL with an indexed auto incrementing column, id, how do I get the id of the last inserted row? Thanks in advance, Dan Dan Anderson said: > If I insert a row into mySQL with an indexed auto incrementing column, > id, how do I get the id of the last inserted row? Use the LAST_INSERT_ID() function. Or, see these pages: http://www.mysql.com/doc/en/Getting_unique_ID.html http://www.mysql.com/doc/en/mysql_insert_id.html By the way, this isn't the place to ask that question. Colin -- Colin W. Wetherbee http://hydrogen.denterprises.o...

Getting the last inserted row ID
Hey all, Just started to use ASP.NET and jumped in at the deep end using the new 2.0 version with VS2005. I've got a data source from which i call an insert command, this works fine. however, i would like to retrieve the ID of the row i have just inserted and store it in a variable in my vb code. How would i go about doing it? So i'm using ASP.NET with VB.NET 2.0 and VS2005 Beta Refresh. I hope you can help me as its really doing my head in now Cheers tom Take a look at this post on my blog/Fredrik Normén - fredrikn @ twitterMicrosoft MVP, MCSD, MCAD, MCTASPInsidersMy B...

Oracle Get New Row ID ON Insert
Hi all, I have constructed a Wizard which collects information bound for two separate Oracle tables.  The first table Web Projects holds information regarding a new unique project beings created including a Sequence created Unique ID called web_projects_seq1.  The second table includes additional information regarding the newly created project. On my aspx page when a user clicks the wizard finish button, the fucntions jobs is then to firstly insert the initial details of the new Project into web_projects, and the second jobs is to insert questions for that project into web_p...

Getting ID of last record inserted (Access).
Hi. How do I get the ID of the last record that I've inserted into an Access Database. ThanksMarno hello, u can do a trick here: string sql = "SELECT MAX(id) FROM tblName"; this way, id is the id for the last stored record, taking into consideration that id is an autonumber, regards.Bilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MVP Thanks Never though about that.Marno...

Getting the Id of the row that i inserted with SQL 2005
Hi,I use a Stored Procedure who works very well....INSERT INTO Computers (CategoryID, SubCategoryID, ......VALUES (@CategoryID, @SubCategoryID, .........But as soon as it creates the new row, i want to be able to get the Id (ComputerId) of this row. I use ComputerId as the primary key.How can i do that? I code in VB.Thanks Add "RETURN SCOPE_IDENTITY()" to your stored procedure. Then you should be able to pick up this value as the stored procedure's return value.Thanks, EdMicrosoft MVP - ASP/ASP.NET Thank you very much it works!...

Is having a trigger that inserts a row in Table 'A', when a row in same table is inserted by ADo.Net code?
I want to insert a row for a Global user  in Table 'A' whenever ADO.Net code inserts a Local user row into same table. I recommended using a trigger to implement this functionality, but the DBA was against it, saying that stored proecedures should be used, since triggers are unreliable and slow down the system by placing unecessary locks on the table. Is this true OR the DBA is saying something wrong? My thinking is that Microsoft will never include triggers if they are unreliable and the DBA is just wanting to offload the extra DBA task of triggers to the programmer so that a s...

what is the simplest way to get the effected row id in access
b"h   thanks for any help. Could you elaborate?  Which effected (affected?) row?Regards Mike [MVP - ASP/ASP.NET]My site when i insert a data into data access i want to get the id of the row that just inserted.   thanks for the help.   Use @@IDENTITY.http://www.mikesdotnetting.com/Article.aspx?ArticleID=54 Regards Mike [MVP - ASP/ASP.NET]My site...

Web resources about - how to get inserted row id - asp.net.access-datasource

Expletive Inserted
Expletive Inserted -

Peripherally inserted central catheter - Wikipedia, the free encyclopedia
A peripherally inserted central catheter ( PICC or PIC line ) is a form of intravenous access that can be used for a prolonged period of time ...

Wafaa Bilal has camera inserted into back of head as part of new art project
THIS is a teacher who really keeps an eye on things. Three eyes, actually.

Man who introduced serious 'Heartbleed' security flaw denies he inserted it deliberately
The German software developer who introduced a security flaw into an encryption protocol used by millions of website globally says he did not ...

Man who introduced serious 'Heartbleed' security flaw denies he inserted it deliberately
The software developer who introduced a security flaw into an encryption protocol used by millions of websites globally says he did not insert ...

[Update: Samsung Responds] Probable Note 5 Design Flaw Can Cause S Pen To Break Pen Detection When Inserted ...
We try not be hyperbolic here at Android Police, so allow me a moment to explain our title here, and why we think it is justified. It is extremely ...

Unreliable Narrators! TechCrunch Blogger Inserted ‘Random Information (Sometimes Even False)’ Into Posts ...
Mr. Siegler. (Photo: LinkedIn) The blogosphere is a brave new news world , but it's generally assumed that blogs that report the news adhere ...

When "the Government trespassorily inserted the information-gathering device" on a car, it was a search ...
Says the Supreme Court, this morning, in United States v. Jones ( PDF ). Scalia writes the privacy-protecting opinion, joined by Roberts, Kennedy, ...

Clinton has stents inserted to open a clogged artery
Secretary of State Hillary Rodham Clinton traveled from Washington to New York to be with her husband, who underwent the procedure at New York ...

Peacock officially inserted into Astros rotation
Peacock officially inserted into Astros rotation

Resources last updated: 12/27/2015 9:41:36 AM