Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX DLL errors, (could not lock file)

Status
Not open for further replies.

MrGunner

Programmer
Sep 3, 2001
8
US
I'm having some trouble programming a simple ActiveX DLL to use for a web site.

Here is my code for the DLL
----------------------------
Option Explicit

Public Function getResponse() As String
Dim db As Database
Dim rsTT As Recordset
Dim strSQL As String
Dim myResponse As String
Set db = OpenDatabase("E:\train.mdb")
strSQL = "select * from Info where ID = 1"
Set rsTT = db.OpenRecordset(strSQL)

myResponse = "Database lookup = " & rsTT.Fields("Name")

rsTT.Close
Set rsTT = Nothing
db.Close
Set db = Nothing

getResponse = myResponse
End Function
-----------------------------

here is my ASP file
-----------------------------
<%
set ServerUtl = server.createobject(&quot;ServerUtlEXE.ServerUtl&quot;)
response.write ServerUtl.getResponse() <-- WHERE ERROR HAPPENS --
%>
-----------------------------

When I run this ASP file from my web server, it should run the dll file, pull out the name from the database and return it through getResponse... but I'm getting an error.

DAO Workspace
Could not lock file
/test.asp line 3

Does anyone know why this would happen?
This is the first time I've tried accessing a database from an ActiveX dll I've programmed other dlls, and this has never happened.
Please help :)
 
ok... I found out my solution... It was nothing with my code, it was an IIS issue.

These problems occur mostly (99%) with Windows 2000 or Windows XP Server. They are documented (and several solutions are presented) in Microsoft Knowledge Base article Q259725. Basically, after being severely critisized for lack of security in Windows NT, they really went overboard with it in Windows 2000 and later. For instance, out of the box, you can't debug ActiveX DLLs in Visual Basic 6. You can run them fine, but you can't debug them.

Why does this occur? Because when you debug an ActiveX DLL which is being called from IIS, you are doing so with the IUSR_machinename account. Now, IUSR_machinename account has permissions to run ActiveX DLL, but when you are debugging in the VB IDE, you are really running VB6.EXE which is actually an ActiveX EXE. IUSR_machinename account has no permissions to run ActiveX EXEs. Permissions for ActiveX EXEs are set through DCOM.

The knowledge base article presents 2 solutions. First solution is a long-term resolution which will allow you to debug any ActiveX DLLs. Second solution will only apply to your current problem. On top of that if your web server is available to the public - it will make everyone log on(!!!), so try the first solution and see if that resolves your problem.

Read the ( ) solution at Microsoft's web site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top