Solved

Microsoft VBScript compilation error

Posted on 2007-03-23
18
695 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IP API - need data... 4 30
JS does not refresh 6 38
Set time on Session (ASP) 14 29
How to build a web site 17 49
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

685 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