Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · Web Hosting Plans · Faisal Khan's Blog · Contact
Forums : ASP : ADO/ODBC : Better than Access stored query ...? Signup · Login
Author Thread
Better than Access stored query ...?
Posted in tutorial: Running Stored Queries in Access Database
·  thierryt64
User
Joined: 6 Feb 2004
Total Posts: 4
Better than Access stored query ...?
Posted: 6 Feb 2004
.. stored prcedures in Access (2000 and above) ?

You bet:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acadvsql.asp

** Better burn bright than fade away ***
·  thierryt64
User
Joined: 6 Feb 2004
Total Posts: 4
Correction... and clarification on @@identity usage
Posted: 7 Feb 2004
I didn't mean to confuse anyone with my previous post.
While stored procedures are available in Access 2000 and above, they can only be created using ADO and the Jet engine, and are invisible from the Access interface; considering there is no real performance gain between a stored procedure and a stored query, there really is no reason to use this capability.

One issue that keeps surfacing when inserting a record through ADO (in ASP/.NET or otherwise), is the apparent difficulty in obtaining the newly created record's key ID - if there is an autoinc field in the table being worked on.

After running some real tests, I finally figured out how to reliably obtain this ID from the database.

From MS Access, create a new query, and save it as Get_KeyID , paste this statement in the SQL view :

SELECT @@IDENTITY AS KeyID;

You can call this stored query right after performing an insert query (stored or not), but it has to use the same ADO connection in order to work and return the ID in question; if the connection is closed between the 2 calls, or a new connection established, it will return 0.

Hope this helped.

** Better burn bright than fade away ***

Users Who Have Visited This Thread In Last 24 Hours
2 Visitors

Login
UserName Or Email Address:       Password:       Auto-Login:    
· Create New User Account
· Send Forgotten Password by Email
 
© 1999 - 2009 Stardeveloper.com, All Rights Reserved.