Click to See Complete Forum and Search --> : Semicolon troubles connecting to DB in ASP


DeathMagus
03-13-2009, 09:13 PM
I hate having to post for help because I feel like a leech, but I don't really see any alternatives at this point. I'm coming over to classic ASP from PHP and it feels like about three steps backwards, but here goes.

I'm trying to connect to an Access database using classic ASP running JScript. It seems that I am constantly getting "Microsoft JScript compilation error '800a03ec'" errors, in which the compiler is expecting semicolons in places semicolons should never go.

A stripped down example of this is the following message:

Microsoft JScript compilation error '800a03ec'

Expected ';'

/test.asp, line 11

Dim con;
----^

From the following code:


<%
Dim con;

Set con = Server.CreateObject("ADODB.Connection");
dbPath = Server.MapPath("database/RHA.mdb");

con.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
%>

Unfortunately, there's not a whole lot of information to go on, so I frankly have no clue where to start. Could anyone lend a hand?

Kuriyama
03-16-2009, 12:05 AM
I don't know a lot about JScript, but it looks like you are mixing VBscript and JScript syntax. I would imagine that is what the problem is.

JScript is JavaScript syntax, and Dim is a VBScript reserved word.

PhilBynoe
03-19-2009, 03:13 PM
Use this ...

<%
Dim con

Set con = Server.CreateObject("ADODB.Connection");
dbPath = Server.MapPath("database/RHA.mdb");

con.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & dbPath & ";"

%>

ASP don´t use ";" to declare variables.

Kuriyama
03-20-2009, 01:07 PM
ASP don´t use ";" to declare variables.
uhhhh yeah it does is you are using JScript as your language. Do not confuse ASP with VBScript. ASP is a server architecture. VBScript is the most common programming language that ASP classic uses.


If JScript is your server side language you need to use JavaScript syntax. The code that you are showing is wrote in VBScript.