Click here to Skip to main content
15,893,644 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am facing an issue during migration of VBScript code from 2003 to 2012 application server. I have registered (regedit) VB dll but unable to run it. I am getting the below error. It's because of declaration of the datatype.

Error:
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/test/sample.asp, line 17
Dim DBConnection As ADODB.Connection
-------------^

Actual 2003 code snippet:
<%
'declare variables
Dim DbConnection As ADODB.Connection
Dim ConStatus as String

'open the connection to database
Set DBConnection=Server.CreateObject("ADODB.Connection")
DBConnection.open "DSN=dsn_name;UID=user_name;PWD=password;Database=database_name"
Set ConStatus=DBConnection.Status
Response.write ConStatus

'Connection close
DbConnection.Close
Set DbConnection=nothing
%>

Changes by removing datatype in declaration of 2003 code snippet:

<%
'declare variables
Dim DbConnection
Dim ConStatus

'open the connection to database
Set DBConnection=Server.CreateObject("ADODB.Connection")
DBConnection.open "DSN=dsn_name;UID=user_name;PWD=password;Database=database_name"
Set ConStatus=DBConnection.Status
Response.write ConStatus

'Connection close
DbConnection.Close
Set DbConnection=nothing
%>

Do, i need to add any dll file to run the application correctly without changing the application code as code changes require some permission. They expecting the migration without code changes. Please help me for solution as i am stucked from 3 days of facing same error.

Thank you in Advance..

Regards,
Balaji

What I have tried:

I have tried by removing the datatype declaration then it worked fine but with given code its not working. Need to add anything like configure dll's.
Posted
Comments
CHill60 16-Jun-16 5:12am    
You say you registered the dll using RegEdit? Personally I would have used regsvr32.exe! And did you use the appropriate version? The one in c:\windows\System32 for 64bit and c:\windows\sysWOW64 for 32 bit
balaji pentela 16-Jun-16 5:47am    
Yes, i have registered with regsvr32.exe and used appropriate version of c:\windows\sysWOW54 location only. Then i have accessed the function(asp page) and its throwing the said error. Actually its new 2012 Server which setup recently for migration.
Richard Deeming 16-Jun-16 8:11am    
Your "actual code snippet" makes no sense. VBScript has never supported strongly-typed variables.
VBScript Data Types[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900