472,354 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

Microsoft VBScript compilation error '800a0400'

6
I can't figure out why I am getting error: Microsoft VBScript compilation '800a0400'

Expand|Select|Wrap|Line Numbers
  1. SET MyRecordSet = SERVER.CREATEOBJECT("ADODB.RECORDSET")
  2. MySQL = "SELECT * FROM ShipSummary (NOLOCK) where ShipDate = DateDiff(d, 0, GetDate()+1)"
  3. MyRecordSet.OPEN MySQL, XXXXXX
  4. if not MyRecordSet.eof then
  5. MyArray = MyRecordSet.GETROWS()
  6. MyRecordSet.CLOSE
  7. FOR MyCursor = LBOUND(MyArray,2) TO UBOUND(MyArray,2)
  8. body = body + "<TR><TD BGCOLOR=""" & SHADE & """><B>" & "&nbsp;</TD><TD BGCOLOR=""" & SHADE & """><B>" & "</TD><TD BGCOLOR=""" & SHADE & """><B>" & 
  9. "&nbsp;</TD><TD COLSPAN=4 BGCOLOR=""" & SHADE & """><B>"& MyArray(0,MyCursor) & "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & """><B>" & 
  10. MyArray(1,MyCursor) & "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & """><B>" & MyArray(2,MyCursor) & "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & 
  11. """><B>" & MyArray(3,MyCursor) & "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & """><B>" & MyArray(4,MyCursor) & "</TD><TD BGCOLOR=""" & SHADE & """>"& 
  12. "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & """></TD></TR>" & vbcrlf
  13. END IF  ....line 61
  14.  
Microsoft VBScript compilation error '800a0400'
Expected statement
/reports/ShipSummary.asp, line 61

END IF^


Can someone help me out or at least point me in the right direction?
Oct 17 '07 #1
5 2743
JamieHowarth0
533 Expert 512MB
I can't figure out why I am getting error: Microsoft VBScript compilation '800a0400'

Expand|Select|Wrap|Line Numbers
  1. SET MyRecordSet = SERVER.CREATEOBJECT("ADODB.RECORDSET")
  2. MySQL = "SELECT * FROM ShipSummary (NOLOCK) where ShipDate = DateDiff(d, 0, GetDate()+1)"
  3. MyRecordSet.OPEN MySQL, XXXXXX
  4. if not MyRecordSet.eof then
  5. MyArray = MyRecordSet.GETROWS()
  6. MyRecordSet.CLOSE
  7. FOR MyCursor = LBOUND(MyArray,2) TO UBOUND(MyArray,2)
  8. body = body + "<TR><TD BGCOLOR=""" & SHADE & """><B>" & "&nbsp;</TD><TD BGCOLOR=""" & SHADE & """><B>" & "</TD><TD BGCOLOR=""" & SHADE & """><B>" & 
  9. "&nbsp;</TD><TD COLSPAN=4 BGCOLOR=""" & SHADE & """><B>"& MyArray(0,MyCursor) & "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & """><B>" & 
  10. MyArray(1,MyCursor) & "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & """><B>" & MyArray(2,MyCursor) & "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & 
  11. """><B>" & MyArray(3,MyCursor) & "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & """><B>" & MyArray(4,MyCursor) & "</TD><TD BGCOLOR=""" & SHADE & """>"& 
  12. "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & """></TD></TR>" & vbcrlf
  13. END IF  ....line 61
  14.  
Microsoft VBScript compilation error '800a0400'
Expected statement
/reports/ShipSummary.asp, line 61

END IF^


Can someone help me out or at least point me in the right direction?
Hi char,

You forgot to add Next above your End If.

Best regards,

medicineworker
Oct 18 '07 #2
char
6
I added the "NEXT" before my "END IF" and now it brings me back to the original error to let me know that no records are found.

"ADODB.Recordset error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

How can I get pass this error and get the records that are available to display?
Oct 18 '07 #3
jhardman
3,406 Expert 2GB
Which line is giving the recordset error? It is likely that you are getting an error because your query isn't returning any records.

If you will allow it, in my opinion, it makes more sense to loop thru the recordset itself rather than dumping the rs into an array and looping thru that, although I realize that you may have reason to do it that way. This is how my code would look:
Expand|Select|Wrap|Line Numbers
  1. MyRecordSet.OPEN MySQL, XXXXXX
  2. do until myRecordSet.eof %>
  3.    <TR><TD BGCOLOR="<%=SHADE%>"> </TD><TD 
  4.    BGCOLOR="<%=shade%>"> </TD><TD BGCOLOR="<%=shade%>"> </TD>
  5.    <TD COLSPAN=4 BGCOLOR="<%=SHADE%>" 
  6.    ><B><%=MyRecordSet(0)%></b></TD><TD ALIGN="CENTER" 
  7.    BGCOLOR="<%=SHADE%>"><B><%=MyRecordSet(1)%></b></TD>
  8.    <TD ALIGN="CENTER" BGCOLOR="<%=SHADE%>"
  9.    ><B><%=MyRecordSet(2)%></b></TD><TD ALIGN="CENTER"
  10.    BGCOLOR="<%=SHADE%>"><B><%=MyRecordSet(3)%></b></TD><TD
  11.    ALIGN="CENTER" BGCOLOR="<%=SHADE%>"
  12.    ><B><%=MyRecordSet(4)%></b></TD><TD BGCOLOR="<%=SHADE%>"
  13.    ></TD><TD ALIGN="CENTER" BGCOLOR="<%=SHADE%>"></TD></TR>
  14.    <%
  15.    myRecordSet.movenext
  16. loop
There is still room for improvement in this code, for example a simple css style declaration would eliminate having to redefine the style on each of these table cells. Also, the individual fields of the db could be looped through like this:
Expand|Select|Wrap|Line Numbers
  1. for each x in myRecordSet.fields ' or for x = 0 to 4 %>
  2.    <TD COLSPAN=4 BGCOLOR="<%=SHADE%>" 
  3.    ><B><%=MyRecordSet(x)%></b></TD>
  4. <%
  5. next 
Does this make sense?

Jared
Oct 18 '07 #4
markrawlingson
346 Expert 100+
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>","&nbsp;")

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
Oct 18 '07 #5
jhardman
3,406 Expert 2GB
cool, Mark, I'd never tried getString(). That looks really useful.

Jared
Oct 18 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Matt | last post by:
When the ASP statement end with a _ character, then the next line cannot have comment ' character. Is that correct? Since I encountered the following error: Microsoft VBScript compilation...
3
by: Adam Short | last post by:
Can anyone help? I have all of a sudden started to receive this error on my site! I have no idea what script it is executing, why it is now failing, what is going on?? All I have been able...
6
by: Adam Short | last post by:
Can anyone help? I have all of a sudden started to receive this error on my site! I have no idea what script it is executing, why it is now failing, what is going on?? All I have been able...
1
by: aklsdjfh | last post by:
I'm no expert in asp and vbscript but not a total beginner. I've got some VBScript in an asp page which is generating a forumla for use in Lotus Notes replication. The line that it is objecting...
2
by: JNariss | last post by:
I keep getting the following error message when trying to preview my page: Microsoft VBScript compilation error '800a0400' Expected statement /TESTESC.asp, line 33
2
by: sonasiva | last post by:
{asp code} Error Type: Microsoft VBScript compilation (0x800A03EE) Expected ')' /web/company_ind.asp, line 35, column 37 Response.Write(objrs("investor_name")""<a...
11
by: remya1000 | last post by:
While running the program, i'm getting this error Microsoft VBScript compilation error '800a0401' Expected end of statement /admin/currentmonth.asp, line 26 strSQL = "SELECT...
3
by: Indy | last post by:
Hi, I am new to VB and have some previous programming experiences. Curently working as an IT support person and trying to write a VB 6 script to access apos database and get one of the table's...
2
by: kevinr | last post by:
Hi, I am brand new to VB, and I am trying to deploy Office 2007 on my network here at work. We used part of this script to do another deployment, and I have taken pieces and tried to edit for this...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.