473,574 Members | 2,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Microsoft VBScript compilation error '800a0400'

6 New Member
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 2844
JamieHowarth0
533 Recognized Expert Contributor
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 New Member
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.Recordse t 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 Recognized Expert Specialist
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 Recognized Expert Contributor
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.GetSt ring(StringForm at, 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,getD ate(),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 Recognized Expert Specialist
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
17096
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 (0x800A0400) Expected statement sqlStmt = "insert into TimeSlot (WeekDay, BeginTime, EndTime) VALUES (" _ ' & 2 & "," _ & beginhour & "," _
3
4666
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 to find out is that Microsoft has had the same problem on their site!
6
3798
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 to find out is that Microsoft has had the same problem on their site!
1
7526
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 to is <% if user2 <> "" then response.write("| @IsMember(&quot;" & LCase(user2) & "&quot;;@LowerCase(@Name(;AssignedTo)))") end if %> i.e. if the string...
2
7978
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
5239
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 href=""investor_ind.asp?investor_name="&objrs("investor_name")&""">"</a>"
11
18644
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 RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted, InvoiceDetail.Quantity, InvoiceDetail.Description, InvoiceDetail.ExtendedPrice,...
3
6234
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 field value. I think this is not that hard for a experience VB programmer, but I am kind a stuggling. Can any one have a similler code for this...
2
4988
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 deployment. I know I am probably way off the mark, but I would appreciate any help. This is the initial error I receive when running the script....
0
7841
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7762
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7859
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6514
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5657
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5336
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3793
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1101
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.