Solved

Microsoft VBScript compilation error

Posted on 2007-03-23
18
690 Views
Last Modified: 2012-05-05
Hi: Can any one please tell me how to fixed that error:
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/reports/Mgmt/Deceased.asp, line 12
Open vFile For Append As #1
-----------^

Dim DBConn,rs,social,vpath,vfile,xLine
Dim WShell
Set WShell = CreateObject("wscript.shell")
vPath = WShell.SpecialFolders("MyDocuments") & "\"
vFile = vPath & "Deceased-Information-" & year(now) & month(now) & day(now) & "-" & hour(now) & minute(now) & second(now) & 

".txt"
Set DBConn = CreateObject("ADODB.Connection")
DBConn.Open "ODBC; Driver=Adaptive Server Anywhere 6.0; DSN=Debtmaster; uid=dm; pwd=,,PeAches..;"
sSQL = "select name1,ssn1 from dbtr where status_code=450 and status_date=today(*) "
Set rs = DBConn.Execute(sSQL)
Do While Not rs.EOF
      Open vFile For Append As #1
            Print #1, PostURL("http://ssdi.rootsweb.com/cgi-bin/ssdi.cgi", "ssn=" & social)
            response.write(rs.Fields("ssn1"))
            response.write("<br>")      
    Close #1            
            rs.moveNext
loop
0
Comment
Question by:mustish1
  • 8
  • 8
  • 2
18 Comments
 

Author Comment

by:mustish1
ID: 18779708
Sorry
Print #1, PostURL("http://ssdi.rootsweb.com/cgi-bin/ssdi.cgi", "ssn=" & rs.Fields("ssn1"))
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18779726
Looks like vb code in a vbs...
Use this instead...

Const ForAppend = 8
Dim objFSO: Set objFSO=CreateObject("Scripting.FileSystemObject")

Set objFile=objFSO.OpenTextFile(vFile, ForAppend)


Then write to it using

objFile.WriteLine "text to write"
0
 

Author Comment

by:mustish1
ID: 18779832
Microsoft VBScript compilation error '800a0401'

Expected end of statement

/reports/Mgmt/Deceased.asp, line 15

Open vFile For Append As #1
-----------^

<%
Dim DBConn,rs,social,vpath,vfile,xLine
Dim WShell
Const ForAppend = 8
Dim objFSO: Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objFile=objFSO.OpenTextFile(vFile, ForAppend)
Set WShell = CreateObject("wscript.shell")
vPath = WShell.SpecialFolders("MyDocuments") & "\"
vFile = vPath & "Deceased-Information-" & year(now) & month(now) & day(now) & "-" & hour(now) & minute(now) & second(now) & ".txt"
Set DBConn = CreateObject("ADODB.Connection")
DBConn.Open "ODBC; Driver=Adaptive Server Anywhere 6.0; DSN=Debtmaster; uid=dm; pwd=,,PeAches..;"
sSQL = "select name1,ssn1 from dbtr where status_code=450 and status_date=today(*) "
Set rs = DBConn.Execute(sSQL)
Do While Not rs.EOF
      Open vFile For Append As #1
            objFile.WriteLine PostURL("http://ssdi.rootsweb.com/cgi-bin/ssdi.cgi", "ssn=" & rs.Fields("ssn1"))
            response.write(rs.Fields("ssn1"))
            response.write("<br>")      
    Close #1            
            rs.moveNext
loop

%>
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 67

Expert Comment

by:sirbounty
ID: 18779851
Try this code...

Const ForAppend = 8
Dim objFSO: Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim DBConn,rs,social,vpath,vfile,xLine
Dim WShell
Set WShell = CreateObject("wscript.shell")
vPath = WShell.SpecialFolders("MyDocuments") & "\"
vFile = vPath & "Deceased-Information-" & year(now) & month(now) & day(now) & "-" & hour(now) & minute(now) & second(now) & ".txt"
Set DBConn = CreateObject("ADODB.Connection")
DBConn.Open "ODBC; Driver=Adaptive Server Anywhere 6.0; DSN=Debtmaster; uid=dm; pwd=,,PeAches..;"
sSQL = "select name1,ssn1 from dbtr where status_code=450 and status_date=today(*) "
Set rs = DBConn.Execute(sSQL)
Set objFile=objFSO.OpenTextFile(vFile, ForAppend)
Do While Not rs.EOF
            objFile.WriteLine PostURL("http://ssdi.rootsweb.com/cgi-bin/ssdi.cgi", "ssn=" & social)
            response.write(rs.Fields("ssn1"))
            response.write("<br>")      
            rs.moveNext
loop
objFile.Close
Authored by: mustish1
0
 

Author Comment

by:mustish1
ID: 18779973
It gives error:
Microsoft VBScript runtime error '800a0035'

File not found

/reports/Mgmt/Deceased.asp, line 13

As I want to create a new text file which is in vFile where i dump the data

Thanks.

Const ForAppend = 8
Dim objFSO: Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim DBConn,rs,social,vpath,vfile,xLine
Dim WShell
Set WShell = CreateObject("wscript.shell")
vPath = WShell.SpecialFolders("MyDocuments") & "\"
vFile = vPath & "Deceased-Information-" & year(now) & month(now) & day(now) & "-" & hour(now) & minute(now) & second(now) & 

".txt"
Set DBConn = CreateObject("ADODB.Connection")
DBConn.Open "ODBC; Driver=Adaptive Server Anywhere 6.0; DSN=Debtmaster; uid=dm; pwd=,,PeAches..;"
sSQL = "select name1,ssn1 from dbtr where status_code=450 and status_date=today(*) "
Set rs = DBConn.Execute(sSQL)
Set objFile=objFSO.OpenTextFile(vFile, ForAppend)
Do While Not rs.EOF
            objFile.WriteLine PostURL("http://ssdi.rootsweb.com/cgi-bin/ssdi.cgi", "ssn=" & social)
            response.write(rs.Fields("ssn1"))
            response.write("<br>")      
            rs.moveNext
loop
objFile.Close
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18780015
Can you upload the script to www.ee-stuff.com (sister site to this one)...
 I think the line wrap is messing up the code...
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18780027
I'm not sure about the PostUrl - is that a function you're calling?

As a test, does this work?
objFile.WriteLine "This is a test..."
0
 

Author Comment

by:mustish1
ID: 18780057
NO error is still on line 13. Its not going further
Microsoft VBScript runtime error '800a0035'

File not found

/reports/Mgmt/Deceased.asp, line 13
0
 

Author Comment

by:mustish1
ID: 18780065
<%
Const ForAppend = 8
Dim objFSO: Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim DBConn,rs,social,vpath,vfile,xLine
Dim WShell
Set WShell = CreateObject("wscript.shell")
vPath = WShell.SpecialFolders("MyDocuments") & "\"
vFile = vPath & "Deceased-Information-" & year(now) & month(now) & day(now) & "-" & hour(now) & minute(now) & second(now) & ".txt"
Set DBConn = CreateObject("ADODB.Connection")
DBConn.Open "ODBC; Driver=Adaptive Server Anywhere 6.0; DSN=Debtmaster; uid=dm; pwd=,,PeAches..;"
sSQL = "select name1,ssn1 from dbtr where status_code=450 and status_date=today(*) "
Set rs = DBConn.Execute(sSQL)
Set objFile=objFSO.OpenTextFile(vFile, ForAppend)
Do While Not rs.EOF
            'objFile.WriteLine PostURL("http://ssdi.rootsweb.com/cgi-bin/ssdi.cgi", "ssn=" & social)
                                    objFile.WriteLine "This is a test..."            
            response.write(rs.Fields("ssn1"))
            response.write("<br>")      
            rs.moveNext
loop
objFile.Close
%>
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18780092
Is this line 13?
Set objFile=objFSO.OpenTextFile(vFile, ForAppend)

If so, then vFile isn't formed correctly...

This looks like two lines to me...
vFile = vPath & "Deceased-Information-" & year(now) & month(now) & day(now) & "-" & hour(now) & minute(now) & second(now) & ".txt"

Try:
vFile = vPath & "Deceased-Information-"
vFile = vFile & year(now) & month(now) & day(now) & "-"
vFile = vFile & hour(now) & minute(now) & second(now) & ".txt"
0
 

Author Comment

by:mustish1
ID: 18780134
Yesit still gives error on line 15
Set objFile=objFSO.OpenTextFile(vFile, ForAppend)
Microsoft VBScript runtime error '800a0035'

File not found

/reports/Mgmt/Deceased.asp, line 15



Const ForAppend = 8
Dim objFSO: Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim DBConn,rs,social,vpath,vfile,xLine
Dim WShell
Set WShell = CreateObject("wscript.shell")
vPath = WShell.SpecialFolders("MyDocuments") & "\"
vFile = vPath & "Deceased-Information-"
vFile = vFile & year(now) & month(now) & day(now) & "-"
vFile = vFile & hour(now) & minute(now) & second(now) & ".txt"
Set DBConn = CreateObject("ADODB.Connection")
DBConn.Open "ODBC; Driver=Adaptive Server Anywhere 6.0; DSN=Debtmaster; uid=dm; pwd=,,PeAches..;"
sSQL = "select name1,ssn1 from dbtr where status_code=450 and status_date=today(*) "
Set rs = DBConn.Execute(sSQL)
Set objFile=objFSO.OpenTextFile(vFile, ForAppend)
Do While Not rs.EOF
            'objFile.WriteLine PostURL("http://ssdi.rootsweb.com/cgi-bin/ssdi.cgi", "ssn=" & social)
                                    objFile.WriteLine "This is a test..."            
            response.write(rs.Fields("ssn1"))
            response.write("<br>")      
            rs.moveNext
loop
objFile.Close
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18780304
What's vtext equal to at that point?

add this line before...
Response.write vFile
Set objFile=objFSO.OpenTextFile(vFile, ForAppend)
0
 

Author Comment

by:mustish1
ID: 18780328
\Deceased-Information-2007323-11347.txt
Microsoft VBScript runtime error '800a0035'

File not found

/reports/Mgmt/Deceased.asp, line 16
0
 

Author Comment

by:mustish1
ID: 18780343
Its not picking up the my document folder.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18780358
Ah...I think I read in another thread that you couldn't get a the shell in ASP...that's probably why... : (
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 500 total points
ID: 18783095
Perhaps this:
Set objFile=objFSO.OpenTextFile(vFile, ForAppend)

Should be replaced with:
Set objFile=objFSO.OpenTextFile(vFile, ForAppend, True)
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 18783574
You seem to have awarded me all the points, when in fact it was sirbounty who did all the work.  See here:
I accepted the wrong answer. Now what?
http://www.experts-exchange.com/help.jsp#hi17
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18785072
Ah well... : (
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sql to convert to date IF entry is in date format 4 81
Use a variable for Class Name in Classic ASP 4 55
asp syntax 3 50
Select record with the most recent date 14 56
Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question