Solved

Microsoft VBScript compilation error

Posted on 2007-03-23
18
700 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

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…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

617 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