Saturday, February 25, 2012

Multiple select in a Store problem

Hi, I have a problem...
Supposed that in a store procedure, I have two operation for example:
insert into mytable field1,field2 values ('bob','bobby')
select max(id) as id_last from mytable
go
in this case I have returned a recordset of one record, of last record
inserted, ok?
With ODBC Connection this work fine, but if I use SQLOLEDB Connection
like:
Provider=SQLOLEDB;Data Source=172.16.1.102;Network
Library=DBMSSOCN;Database=mydata;User ID=abc;Password=123
return this error:
ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name
or ordinal.
I use SQL2000Server in a machine and ASP on IIS6 in another machine
Why
thank you in advance and sorry for my bad english
Stefano
Could you try putting SET NOCOUNT ON at the beginning of the insert?
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Ste" <ste@.3civettesulcomoinews.it> wrote in message
news:%23mDuaOjHFHA.3624@.tk2msftngp13.phx.gbl...
Hi, I have a problem...
Supposed that in a store procedure, I have two operation for example:
insert into mytable field1,field2 values ('bob','bobby')
select max(id) as id_last from mytable
go
in this case I have returned a recordset of one record, of last record
inserted, ok?
With ODBC Connection this work fine, but if I use SQLOLEDB Connection
like:
Provider=SQLOLEDB;Data Source=172.16.1.102;Network
Library=DBMSSOCN;Database=mydata;User ID=abc;Password=123
return this error:
ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name
or ordinal.
I use SQL2000Server in a machine and ASP on IIS6 in another machine
Why
thank you in advance and sorry for my bad english
Stefano
|||Thank you, that's ok
"Narayana Vyas Kondreddi" <answer_me@.hotmail.com> ha scritto nel messaggio
news:eOp4aflHFHA.2620@.tk2msftngp13.phx.gbl...
> Could you try putting SET NOCOUNT ON at the beginning of the insert?
> --
> HTH,
> Vyas, MVP (SQL Server)
> SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
>
> "Ste" <ste@.3civettesulcomoinews.it> wrote in message
> news:%23mDuaOjHFHA.3624@.tk2msftngp13.phx.gbl...
> Hi, I have a problem...
> Supposed that in a store procedure, I have two operation for example:
> insert into mytable field1,field2 values ('bob','bobby')
> select max(id) as id_last from mytable
> go
> in this case I have returned a recordset of one record, of last record
> inserted, ok?
> With ODBC Connection this work fine, but if I use SQLOLEDB Connection
> like:
> Provider=SQLOLEDB;Data Source=172.16.1.102;Network
> Library=DBMSSOCN;Database=mydata;User ID=abc;Password=123
> return this error:
> ADODB.Recordset error '800a0cc1'
> Item cannot be found in the collection corresponding to the requested name
> or ordinal.
> I use SQL2000Server in a machine and ASP on IIS6 in another machine
> Why
> thank you in advance and sorry for my bad english
> Stefano
>
>

No comments:

Post a Comment