I'm constantly puzzled when I see people setting the bgcolor attribute of every single <td> tag - even setting the background-color attribute of the td tag in a stylesheet is puzzling. Why? Set the bgcolor of your <tr> tag and it will cascade across all of your <td> tags automatically. the only reason you'd want to set the bgcolor of a td tag is to change it's colour from the normal colour to an offset or highlighting colour of some sort...
Using GetRows to push the information in your recordset into an array is a fantastic way of dealing with data that comes from a database - however it can get complicated VERY quickly because unless your SQL statement is only pulling one column, you're going to return a multi-dimensional array and those can be hell. Using this method also helps speed up your asp pages immensely, it's very effective. However, for practical day to day use, it's better to just iterate through your recordset normally! I only use GetRows in very isolated scenarios. You may want to try GetString though. It's similar to GetRows in the sense that you can grab your data from your recordset, take it out, put it somewhere else, and then close your recordset up - except GetRows pushes the data into an Array, getString pushes the data into a String type variable - and you can tell it how to seperate the data in one line. For simple displaying of data where you don't care a WHOLE lot about the look and feel of the way the data is being spat out.. this is a fantastic way of going about it.
Here the syntax...
String = recordset.GetString(StringFormat, NumRows, ColumnDelimiter,
RowDelimiter, NullExpr)
An example...
strTable = rs.GetString(,,"</td><td>","</td></tr><tr><td>"," ")
This will seperate your data using td tags to seperate each column, and <tr> tags to seperate each row. Like you normally would most of the time anyway.
And a resource...
http://www.expertsforge.com/Web-Deve...utorial-38.asp
Anyway, that's besides the point. You're returning eof because of the following statement...
WHERE ShipDate = DateDiff(d, 0, GetDate()+1)
You're telling your database to return all columns within all records from the table called ShipSummary, but only if ShipDate is Equal to the difference in days between 0 and tomorrow - That doesn't make sense to SQL! What exactly is 0? And how exactly does one computer the difference in days between 0 and tomorrow?
So there are two problems with that.
DateDiff requires 2 valid dates to function properly. It will return a numerical value of (milliseconds, seconds, minutes, hours, etc whatever you specify) between the first date and the second date. Take these DateDiff statements as an example..
DateDiff(d,getDate(),getDate()+1) - this will return 1 because there is 1 days difference between today and tomorrow
DateDiff(d,10/10/2007,getDate()) - Since today's date (for me) is October the 18th 2007 - this statement will return 8 because there are 8 days between october the 10th and october the 18th.
The second problem with that statement is that you are telling SQL to return all records where the value of the column called ShipDate is equal to the value that DateDiff returns. If the column ShipDate contains and integer value, that's fine, but my guess is that it contains a DATE format like 10/10/2007 - in which case you are basically saying...
WHERE ShipDate = 1
Which will never be true, and thus no records will ever be returned, and your recordset will indefinitely return EOF.
Below is the proper way to compare the number of days between the value of a column in your database, and another date using DateDiff().
MySQL = "SELECT * FROM ShipSummary (NOLOCK) where Datediff(dd, ShipDate, GetDate()) = 1;"
Or if you want to return all records where ShipDate has a date within the last 7 days...
MySQL = "SELECT * FROM ShipSummary (NOLOCK) where Datediff(dd, ShipDate, GetDate()) <= 7;"
Hope that helps you out!
Sincerely,
Mark