Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Dreamweaver (all versions)
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) 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
  #21 (permalink)  
Old November 30th, 2005, 01:11 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

the data base for this case is a single table with 50 columns.it has just a table and it dosen't relate to any table.there is 5000 HGs and i query 3000 of them.at the first of looping there is 3000 HGs and my select statement is:
rs.Source = "SELECT Row,HGNo,HGName,UnitNo,ScopeOfWork,YesNo,Remark,Ac tualDeliveryDateFromOrigin,ActualDeliveryDateToIra nCustom,CustomsClearance FROM dbo.tbHGInf WHERE Row is not null"
by Row filtering i have thoese 3000 HGs that i've told you.
i can't make more filters because if i do that i won't have all HGs that i want.I didn't write any query in my database.I wrote all of it in my asp page.I should have all these loops beause for each cell it should check all the database and then if it was matched with the HGNo and UnitNo then call the fuction to show its situation.
table is something like this:
-------------------------------------------------------------------
 HGNo|unit1 | unit2 | unit3 | unit4 |.........|unit50
-------------------------------------------------------------------
6320|aspscript|aspscript|aspscript|aspscript| |aspscript
in this table 6320 is a HG number.and for unit1-unit50 we shoud show its situation.so i wrote while loop for each cell(aspscript) to find the HG number 6320 for unit1 for example and so on for other Hgs is like the same.in the database a record is for HG6320 and unit 1 and the other record is for HG6320 and unit 2 and....
i hope these explanations are sufficent for fixing the problem.i really don't know how to explane it.sorry if i couldn't explane.

Reply With Quote
  #22 (permalink)  
Old November 30th, 2005, 03:16 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

I still don't get it completely. But that doesn't matter though.

Looping through a recordset with 3000 records only to find one is insane. Looping through that same records many times is even worse.

There may be much more efficient ways to solve it, but since I don't under your business logic, table design and query plans, I cannot offer a very good solution.

A quick win would be to execute a separate SQL statement for each of the items you have now. That way, you still need to fire 30 or 40 queries or so, but it at least saves you from looping through a 3000-record recordset 40 times.

Sorry I cannot help much more with this; I just don't get it. You can help yourself though, by *writing* down what it is you want the application to do. Stepping away from code and back to pen and paper often helps in figuring out a better solution.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #23 (permalink)  
Old December 3rd, 2005, 04: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

I verified a new recordset for each HG.it is 34 recordsets with filtering that HGno:
<%
Dim rs5
Dim rs5_numRows

Set rs5 = Server.CreateObject("ADODB.Recordset")
rs5.ActiveConnection = MM_QCcon_STRING
rs5.Source = "SELECT Row,HGNo,HGName,UnitNo,ScopeOfWork,YesNo,Remark,Ac tualDeliveryDateFromOrigin,ActualDeliveryDateToIra nCustom,CustomsClearance FROM dbo.tbHGInf WHERE HGNo='6080' and Row is not null"



rs5.CursorType = 0
rs5.CursorLocation = 2
rs5.LockType = 1
rs5.Open()

rs5_numRows = 0
%>
but now it shows the first Row but in the first column of the second row it gives me this error:
error '80020009' exception occured
and this is the code for the line that it gives error:
                         if (rs("ScopeOfWork")<>"Siemens") And (rs("ScopeOfWork")<>"alstom") and (rs("YesNo")="yes") then%>
and it is the first line of my function that i wrote.
why is it give me such error???shouln't i verify those recordsets??is it making problem for a program to have 34 recorsets???

Reply With Quote
  #24 (permalink)  
Old December 3rd, 2005, 05:33 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

Are you closing the previous recordset before you open a new one?

Instead of creating 34 recordsets, you can close the old one, change the Source property and open it again....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #25 (permalink)  
Old December 3rd, 2005, 05:38 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

i closed all recordsets at the end of program.i will do as you said.thank you

Reply With Quote
  #26 (permalink)  
Old December 4th, 2005, 12:48 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

I closed the old recordset and open it again with different property but it gives me timeout error again:(i'm really confused:(what should i do?:(

Reply With Quote
  #27 (permalink)  
Old December 4th, 2005, 07:05 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,

What you should is something I recommended a couple of months ago as well: get a few good books on ASP and databases and improve your understanding of how ASP and databases work. Read up on normalization, database design in general and ASP / database interaction.

You seem to be missing a few fundamental concepts that stop you from building efficient, well-designed and maintainable applications.

I don't want to sound rude, but without this knowledge you'll keep running into the same problems.

There may be ways to "fix" the current application, but I can't recommend any because I don't know enough about the application's design and intended usage. However, there is nothing better than a good initial design, which is, IMHO, something you need now before you try to fix the current problems....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: You Think I Ain't Worth A Dollar, But I Feel Like A Millionaire by Queens of the Stone Age (Track 2 from the album: Songs For The Deaf) What's This?
Reply With Quote
  #28 (permalink)  
Old December 4th, 2005, 12:18 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 is fixed now.but you are right and i should study about some fudemental things in asp and SQL.i have some books in asp and SQL but i don't get things that i want from them.would you suggest a good refrence please.


Reply With Quote
  #29 (permalink)  
Old December 4th, 2005, 12:19 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 is fixed now.but you are right and i should study about some fudemental things in asp and SQL.i have some books in asp and SQL but i don't get things that i want from them.would you suggest me a good refrence please.


Reply With Quote
  #30 (permalink)  
Old December 4th, 2005, 12:28 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

Being one of the authors, I am a bit biased, but one book I can recommend is Beginning Dreamweaver MX 2004 (http://www.wrox.com/WileyCDA/WroxTit...764555243.html)

It covers databases, ASP and JavaScript at the same time.

If you're using SQL Server, another book to check out is Professional SQL Server 2000 Programming (http://www.wrox.com/WileyCDA/WroxTit...764543792.html) by Robert Vieira. It's my favorite book about SQL Server and T-SQL.
(Note that this book deals with SQL Server exclusively; you won't find much code that shows you how to use SQL Server and ASP.)

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Going To Your Funeral Part 2 by Eels (Track 9 from the album: Electro-shock Blues) What's This?
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
loop through static list of values? mister_mister XSLT 6 January 4th, 2008 11:48 AM
help writing dynamic form data to dynamic table ublend Classic ASP Professional 1 June 1st, 2007 08:08 AM
Dynamic Checkboxes using dynamic Select Values bsheridan Classic ASP Databases 0 March 12th, 2006 10:17 AM
Dynamic table values not returned in Netscape jminteer Classic ASP Professional 1 December 16th, 2005 03:43 PM
static HTML table border problem Robin1 HTML Code Clinic 4 August 12th, 2004 04:58 AM



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


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