p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Professional (http://p2p.wrox.com/forumdisplay.php?f=63)
-   -   help me please (http://p2p.wrox.com/showthread.php?t=40358)

hastikeyvan March 25th, 2006 03:30 AM

help me please
Hello all
I have a problem with recorset.is there any one here can help me please???
I have 11 different recordsets.i want to use them in an array.is the code below correct?
for each elementArray in a

while not a(i).eof
'do some thing'
but it gives me object required:rs error for the line that has a(i).movefirst()
rs1,..rsn are recordsets
would you please tell me where is the problem
thank you

Imar March 25th, 2006 04:02 AM

Hi hastikeyvan,

Take a look at this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=10984


Imar Spaanjaars
Everyone is unique, except for me.

hastikeyvan March 27th, 2006 01:50 AM

Hello Imar again:)
thank you for link you've intrtoduced me.I think i didn't explain my problem in a good way.or maybe i couldn't get the main idea of the link.I think the link was about creating recordsets during a for loop.but i created my recordsets and because their irregular conditions i cant creat them with a for loop.my problem is call these recordsets with a for loop.when i use the code that i wrote for you it gives me error.
i don't know where is the problem.please help me to fix it.
thank you again for your helps.

Imar March 27th, 2006 01:12 PM

The main point to take from the link I posted is not the loop, but the usage of the Set keyword, and the way the recordsets are disconnected.

If you don't disconnect them, and don't use set, it won't work...

Imar Spaanjaars
Everyone is unique, except for me.

hastikeyvan April 3rd, 2006 08:45 AM

Dear Imar
thank you for your kindly helps. the link was very very usefull and i could learn many things from it and now i don't have the problem again.but another problem is happen unfortunately:(
I have 11 recordsets and in the page it shows 11 records for each item that has the conditions i wrote for.
here is one of the recordsets.would you guide me to fix this problem too:
rs.Source = "SELECT tbUnit.DateOfStart,tbUnit.UnitNo,tbHGInf.UnitNo As Expr3,tbHGInf.HGNo, tbPlan.HGNo AS Expr1, tbHGInf.HGName, tbPlan.HGName AS Expr2, tbHGInf.ActualDeliveryDateToIranCustom1,tbHGInf.Re mark,tbHGInf.CustomsClearance1, tbHGInf.LatestNeeded1, tbHGInf.ManufactureStart1, tbHGInf.ManufactureEnd1, tbHGInf.ActualDeliveryDateFromOrigin1,tbHGInf.Cont ract1, tbHGInf.SiemenseReleaseNote1, tbHGInf.SGSFinalApproval1, tbPlan.SiteWorkshop, tbPlan.Kit, tbPlan.OrderDuration,tbPlan.SManufactureDuration, tbPlan.ReciveIranDuration, tbPlan.PackageDuration, tbPlan.ShamsAbadDuration, tbPlan.SiteDuration FROM tbHGInf INNER JOIN tbPlan ON tbHGInf.HGNo = tbPlan.HGNo AND tbHGInf.HGName = tbPlan.HGName INNER join tbUnit on tbHGInf.UnitNo=tbUnit.UnitNo where (tbPlan.UnitNo='1') and (tbHGInf.UnitNo='25')"

thank you again Mr Imar.your messages always help me to understand new things.

Imar April 3rd, 2006 11:47 AM

Hi hastikeyvan,

I am glad you found the post helpful.

quote:would you guide me to fix this problem too
Sure, if you tell me what the problem is. All I see is a bunch of T-SQL statements...

Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: And Dream Of Sheep by Kate Bush (Track 6 from the album: Hounds Of Love) What's This?

hastikeyvan April 3rd, 2006 11:59 PM

Hello Imar
The problem has been changed.thats the way i did:
1-create 11 recordsets(manually not dynamically)
2-set recordsets in an array:
Dim Array(11)
set Array(0)=rs
set Array(10)=rs10

3-set connection=nothing
4-write a for loop for looping through 11 recordsets:
for i=0 to 10
while not Array(i).eof
bla bla bla
but it gives me eof or bof error and i test my recordsets in SQL they are not empty
i'm really confused:(how can i fix it:(please help me as before
thank you Imar and excuse me if i ask such questions

Imar April 4th, 2006 12:58 PM

Hi hastikeyvan,

I am not sure if I like the idea of working with arrays of recordsets like this. Recordsets can consume a lot of memory, and holding 11 of them in memory at the same time, is asking for troubles.

That said, I think the key to your problem is the Set keyword again. I haven't tried it, but I don't think you can use array(i).MoveNext like that. You may need to assign it to a local variable first:

Dim localRecordset
For i = 0 To 10
  Set localRecordset = Array(i)
  While Not localRecordset.Eof
    bla bla bla

Also, I wouldn't be surprised if Array is a reserved word, so hopefully you're using a different variable name.

Hope this helps,

Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: Subculture by New Order (Track 8 from the album: Substance - Disc 1) What's This?

mat41 April 4th, 2006 06:48 PM

;;;I don't think you can use array(i).MoveNext

I have tryed, it failed for me.

Wind is your friend

hastikeyvan April 5th, 2006 11:47 PM

I set the keyword again but it gives me eof or bof error again.Imar,you've written me that using recordsets in an array is not a good way.what can I do instead of using array?i don't know if there is better way to get the same result as using array .please tell me if there is a better way.can I use s.th like this?
1-creat rcordsets:
2-for i=0 to 10
set virtualRecordset=rs&i
and other thing

thank you

All times are GMT -4. The time now is 06:06 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.