Prev: multi file download with one click
Next: FAQ Topic - How do I get the value of a form control? (2010-02-06)
From: Rob Christiansen on 5 Feb 2010 18:01 what is wrong? Below is my code and error message: var RelativePathToAccessFile = databasename var AbsolutePathToAccessFile = Server.MapPath( RelativePathToAccessFile ) var FSO = Server.CreateObject("Scripting.FileSystemObject") var ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + AbsolutePathToAccessFile + ";" var ConnectionObject = Server.CreateObject("ADODB.Connection") ConnectionObject.Open( ConnectionString ) var sql = "SELECT * FROM santa1 " var rs = Server.CreateObject("ADODB.RecordSet") rs.Open ( sql, ConnectionObject ); ------------------------- //Microsoft VBScript compilation error '800a0414' //Cannot use parentheses when calling a Sub ///santa/smaster_list.asp, line 41 //rs.Open ( sql, ConnectionObject ); //---------------------------------^ *** Sent via Developersdex http://www.developersdex.com ***
From: Malcolm Dew-Jones on 5 Feb 2010 22:04 Rob Christiansen (robb_christiansen(a)q.com) wrote: : what is wrong? Below is my code and error message: : : var RelativePathToAccessFile = databasename : var AbsolutePathToAccessFile = Server.MapPath( RelativePathToAccessFile : ) : var FSO = Server.CreateObject("Scripting.FileSystemObject") : var ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + : AbsolutePathToAccessFile + ";" : var ConnectionObject = Server.CreateObject("ADODB.Connection") : ConnectionObject.Open( ConnectionString ) : var sql = "SELECT * FROM santa1 " : var rs = Server.CreateObject("ADODB.RecordSet") : rs.Open ( sql, ConnectionObject ); : ------------------------- : //Microsoft VBScript compilation error '800a0414' : //Cannot use parentheses when calling a Sub : ///santa/smaster_list.asp, line 41 : //rs.Open ( sql, ConnectionObject ); : //---------------------------------^ error #1, wrong group error #2, rs.Open //Cannot be called use'ing parentheses (I guess)
From: Thomas 'PointedEars' Lahn on 5 Feb 2010 23:36 Malcolm Dew-Jones wrote: > Rob Christiansen (robb_christiansen(a)q.com) wrote: > : what is wrong? Below is my code and error message: > > : > : var RelativePathToAccessFile = databasename > : var AbsolutePathToAccessFile = Server.MapPath( RelativePathToAccessFile > : ) > : var FSO = Server.CreateObject("Scripting.FileSystemObject") > : var ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + > : AbsolutePathToAccessFile + ";" > : var ConnectionObject = Server.CreateObject("ADODB.Connection") > : ConnectionObject.Open( ConnectionString ) > > : var sql = "SELECT * FROM santa1 " Bad idea. Instead, always provide a comma-separated list of the names of the fields you need, in the desired order. > : var rs = Server.CreateObject("ADODB.RecordSet") > : rs.Open ( sql, ConnectionObject ); > : ------------------------- > : //Microsoft VBScript compilation error '800a0414' > : //Cannot use parentheses when calling a Sub > : ///santa/smaster_list.asp, line 41 > : //rs.Open ( sql, ConnectionObject ); > : //---------------------------------^ > > error #1, wrong group > error #2, rs.Open //Cannot be called use'ing parentheses (I guess) If I am not very mistaken, all those error messages are bogus :) 1. This looks like ECMAScript-compliant code (as the `var' indicates), so for that it is on-topic here (however, it is true that general runtime environment issues are better asked about elsewhere.) 2. The problem is very likely that the trailing semicolon is not accepted here, not the parentheses (they had been accepted in that context before -- remember the old helicopter Microsoft joke?). This would be because the wrong scripting engine (VBScript instead of JScript) had been used. Therefore, the OP should append the semicolons to the other statements (code style), after which, if my assumption above is correct, the VBScript syntax error will be reported earlier. If so, then they need to tell ASP that this is JScript code instead of the default VBScript, after which there should not be a problem here: <%@ LANGUAGE = "JScript" %> The alternative, which I would recommend against, is to rewrite this in VBScript. See also <http://msdn.microsoft.com/en-us/library/ms525153.aspx> (these really are ASP *basics*!) PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300dec7(a)news.demon.co.uk>
From: Andrew Poulos on 6 Feb 2010 04:17 On 6/02/2010 10:01 AM, Rob Christiansen wrote: > what is wrong? Below is my code and error message: > > > var RelativePathToAccessFile = databasename > var AbsolutePathToAccessFile = Server.MapPath( RelativePathToAccessFile > ) > var FSO = Server.CreateObject("Scripting.FileSystemObject") > var ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + > AbsolutePathToAccessFile + ";" > var ConnectionObject = Server.CreateObject("ADODB.Connection") > ConnectionObject.Open( ConnectionString ) > > var sql = "SELECT * FROM santa1 " > var rs = Server.CreateObject("ADODB.RecordSet") > rs.Open ( sql, ConnectionObject ); > ------------------------- > //Microsoft VBScript compilation error '800a0414' > //Cannot use parentheses when calling a Sub > ///santa/smaster_list.asp, line 41 > //rs.Open ( sql, ConnectionObject ); > //---------------------------------^ At the top of the page you need <%@ language="javascript" %> otherwise I believe the server assumes that its vbscript. Andrew Poulos
From: Evertjan. on 6 Feb 2010 06:28 Andrew Poulos wrote on 06 feb 2010 in comp.lang.javascript: > At the top of the page you need > > <%@ language="javascript" %> > > otherwise I believe the server assumes that its vbscript. By default but depending on the IIS settings. The OP server's IIS could have been set to Jscript. ===================================== Second optiom, using: <script language='jscript' runat='server'> </script> to have only this part of the asp script use jscript, and that part will run prior to any default languaged VBS. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
|
Next
|
Last
Pages: 1 2 Prev: multi file download with one click Next: FAQ Topic - How do I get the value of a form control? (2010-02-06) |