Solved

Microsoft VBScript compilation error

Posted on 2007-03-23
18
696 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
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 if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

738 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