Solved

Microsoft VBScript compilation error

Posted on 2007-03-23
18
683 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
JSON error 4 38
Import csv files to MS SQL 5 61
Problem to Popup 2 53
Problem to picture file 3 42
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to count occurrences of each item in an array.

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now