Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 25th, 2006, 03:30 AM
Friend of Wrox
 
Join Date: May 2005
Location: tehran, tehran, Iran.
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default 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?
a=array("rs",...."rsn")
for each elementArray in a

a(i).movefirst()
while not a(i).eof
'do some thing'
wend
next
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



Reply With Quote
  #2 (permalink)  
Old March 25th, 2006, 04:02 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi hastikeyvan,

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

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #3 (permalink)  
Old March 27th, 2006, 01:50 AM
Friend of Wrox
 
Join Date: May 2005
Location: tehran, tehran, Iran.
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default

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.

Reply With Quote
  #4 (permalink)  
Old March 27th, 2006, 01:12 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #5 (permalink)  
Old April 3rd, 2006, 08:45 AM
Friend of Wrox
 
Join Date: May 2005
Location: tehran, tehran, Iran.
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default

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.

Reply With Quote
  #6 (permalink)  
Old April 3rd, 2006, 11:47 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi hastikeyvan,

I am glad you found the post helpful.
Quote:
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
---------------------------------------
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?
Reply With Quote
  #7 (permalink)  
Old April 3rd, 2006, 11:59 PM
Friend of Wrox
 
Join Date: May 2005
Location: tehran, tehran, Iran.
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default

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
Array(i).movefirst()
while not Array(i).eof
bla bla bla
wend
next
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


Reply With Quote
  #8 (permalink)  
Old April 4th, 2006, 12:58 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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:
Code:
Dim localRecordset
For i = 0 To 10
  Set localRecordset = Array(i)
  localRecordset.MoveFirst()
  While Not localRecordset.Eof
    bla bla bla
  Wend
Next
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
---------------------------------------
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?
Reply With Quote
  #9 (permalink)  
Old April 4th, 2006, 06:48 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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

I have tryed, it failed for me.

Wind is your friend
Matt
Reply With Quote
  #10 (permalink)  
Old April 5th, 2006, 11:47 PM
Friend of Wrox
 
Join Date: May 2005
Location: tehran, tehran, Iran.
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default

Hi
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:
rs0
rs1
..
rs10
2-for i=0 to 10
set virtualRecordset=rs&i
virtualRecordse.movefirst()
and other thing

thank you




Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off




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


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