kkabbara
Posts: 14
|
Posted: 01/21/2004, 12:50 PM |
|
I am going nutz on this problem.
I have a SP called "CSC" which returns one value from SQL and I need to place it into a label. I keep on getting the following error:
ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal.
What goes?
Thanks in advance.
dim sSQL, thespparam, rs, Years ,Connection,ErrorMessage
Years = 2004
thespparam = FromName.ID.value & ", " & Years
sSQL = "CSC " & thespparam
Set Connection = New clsDBConnection
Connection.Open
SET rs = Connection.Execute(sSQL)
FromName.label1.Value = rs(1)
ErrorMessage = CCProcessError(Connection)
Connection.Close
Set Connection = Nothing
On Error Goto 0
|
|
|
kkabbara
Posts: 14
|
Posted: 01/21/2004, 1:00 PM |
|
FYI: This works when I use a standard SQL statement.. scratching head...
|
|
|
BlinkyBill
Posts: 86
|
Posted: 01/21/2004, 1:16 PM |
|
Quote kkabbara:
I have a SP called "CSC" which returns one value from SQL and I need to place it into a label. I keep on getting the following error:
FromName.label1.Value = rs(1)
as per the ADO 2.6 reference:
The Fields collection is the default member of the Recordset object. As a result, the following two code statements are equivalent.
Debug.Print objRs.Fields.Item(0) ' Both statements print
Debug.Print objRs(0) ' the Value of Item(0).
Note the items are ZERO based.
|
|
|
kkabbara
Posts: 14
|
Posted: 01/21/2004, 1:22 PM |
|
Blinky,
I still get the same error message when I use both statements.
|
|
|
Edd
Posts: 547
|
Posted: 01/21/2004, 1:38 PM |
|
1. Are you sure you are returning anything to the recordset as you are not testing for EOF.
2. If that fails try to build the SP using the formal methon od adding parameters.
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
|
|
kkabbara
Posts: 14
|
Posted: 01/21/2004, 1:57 PM |
|
Edd,
Quote :1. Are you sure you are returning anything to the recordset as you are not testing for EOF.
Yes I am returning and it works.
I will need to try the add parameters any good articles for add parameters?
Thanks
Karim
|
|
|
Edd
Posts: 547
|
Posted: 01/21/2004, 11:04 PM |
|
Try http://support.microsoft.com/default.aspx?scid=http://s...&NoWebContent=1
Also http://www.devguru.com is a good reference site for ADO and ASP
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
|
|
kkabbara
Posts: 14
|
Posted: 01/22/2004, 11:26 AM |
|
Thanks Edd!
Okay so now I am using add parameters, guess what I am getting a ZERO as my returned number. Waz up with tha?
Any ideas?
|
|
|
peterr
Posts: 5971
|
Posted: 01/22/2004, 11:43 AM |
|
Rs collections start with 0, therefore try rs(0) instead of rs(1).
This the same solution as Bill proposed above but I'm not sure that this what you tested.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
kkabbara
Posts: 14
|
Posted: 01/22/2004, 1:48 PM |
|
Peterr,
I've been working with RS(0) nothing comes up or it says rs is already closed in some istances.
|
|
|
Edd
Posts: 547
|
Posted: 01/22/2004, 8:15 PM |
|
kkabbara,
Can you post your stored procedure and the ASP code that calls it.
Maybe we are missing something.
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
|
|
kkabbara
Posts: 14
|
Posted: 01/23/2004, 12:55 PM |
|
Thanks for all that tried to help.
It was a complex SP which needed the statement, had a call to another SP on another server etc. : SET NOCOUNT ON and OFF
I ran the Add.Parameters and it worked.
CCS Developers should have a way to use stored Proc's using CCS function. e.g. CCSProc("NameofSP",Parameters could be one or many,ColumnPOS or Name which would return the value you are looking for,DBConnectionName)
Now I can do this
Label1.value = CCSProc("MysimpleSP","1,2",0,"DBConnection1)
Just a thought.
I had to write mine.
Thanks,
Karim
|
|
|