Re: Output parameters for Access 2000 stored procedure
From: Alex Dybenko (alex_at_PLEASE.cemi.NO.rssi.SPAM.ru)
Date: 01/24/05
- Next message: William Wang[MSFT]: "Re: Package Wizard"
- Previous message: Ollie: "Re: Output parameters for Access 2000 stored procedure"
- In reply to: Ollie: "Re: Output parameters for Access 2000 stored procedure"
- Next in thread: Ollie: "Re: Output parameters for Access 2000 stored procedure"
- Reply: Ollie: "Re: Output parameters for Access 2000 stored procedure"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 24 Jan 2005 20:14:54 +0300
Hi,
something like this:
SP sp_InsertIntoTable1 :
Insert into table1 (field1) Values (1)
select @@Identity
and code:
Set qryd = dbs.CreateQueryDef("")
qryd.Connect = "<con string>"
qryd.SQL = "sp_InsertIntoTable1"
qryd.ReturnsRecords = true
Set rst = qryd.OpenRecordset(dbOpenForwardOnly)
If Not rst.EOF Then
debug.print = rst(0).Value
End If
HTH
-- Alex Dybenko (MVP) http://Alex.Dybenko.com http://www.PointLtd.com "Ollie" <Ollie@discussions.microsoft.com> wrote in message news:BE3EDF67-F4CA-4A44-9F24-002DE262F24F@microsoft.com... > Hi Alex, > > thanks for the response. > > Could you clarify what you mean when you say: > " I am returning value from SP in your case as using select > @@identity at the end of proc, and in access I get it by opening recordset > on "exec sp" and retrieving Fields(0)" > > If you could give an example of how I would use your method to return the > primary key of a newly inserted record, that would great. > > Cheers, > Ollie > > "Alex Dybenko" wrote: > >> Hi Ollie, >> output parameter - don't remember exactly, but I believe these is a way >> doing this using ADO parameter >> >> personally - I am returning value from SP in your case as using select >> @@identity at the end of proc, and in access I get it by opening >> recordset >> on "exec sp" and retrieving Fields(0) >> >> -- >> Alex Dybenko (MVP) >> http://Alex.Dybenko.com >> http://www.PointLtd.com >> >> >> "Ollie" <Ollie@discussions.microsoft.com> wrote in message >> news:F2EBB8CF-01E1-41E5-91D4-170C7A2D8F8B@microsoft.com... >> > Is it possible to create a stored procedure for Access 2000 that has an >> > output parameter? I know this is possible with SQL Server but have not >> > been >> > able to track down an equivilent example for Access. >> > >> > If it is not possible, can anyone suggest a way of returning a value >> > from >> > an >> > insert query (e.g. the primary key of a newly created record) from >> > Access >> > 2000 to an calling application (e.g. ASP application). >> > >> > Cheers, >> > Ollie >> > >> >> >>
- Next message: William Wang[MSFT]: "Re: Package Wizard"
- Previous message: Ollie: "Re: Output parameters for Access 2000 stored procedure"
- In reply to: Ollie: "Re: Output parameters for Access 2000 stored procedure"
- Next in thread: Ollie: "Re: Output parameters for Access 2000 stored procedure"
- Reply: Ollie: "Re: Output parameters for Access 2000 stored procedure"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|