RT error 70 Permission Denied

  • I'm having some issues with some code modifications I'm making to an application that I inherited.  First off I'm a DBA by trade, so I'm not so great with the whole VB thing, but I'm learning.

    I have an ASP application that calls VB6 dlls (com plus components) on my server.  To do some word automation, the components are exported to an application proxy which is installed on the client machines and is referenced by automateword.dll. The changes I made to the app, were very small changing a variable from an int to a long etc... I recompiled everything and the web app seems to work great.

    Now, when I export my app proxy, install and try to run automateword scripts I end up with Permission denied errors.  I'm trying to figure out where these are coming from, and due to my inexperience with the language I'm unable to.  Are they coming from a) automateword itself (unlikely, it opens the word doc and saves it no problem), b) the .dll from my app proxy on the client machine (also a bit unlikely because I can reference other things from the local dll.) c) from the com plus application on the server (I'm not sure about this one) or d) from the database (not likely as everything seems to work there).

    When I create a test exe I can reference the connection string from my local dll to directly query the database.  When I call a method from the local dll that in turn calls the database I am receiving my permission denied problem.  I can't seem to get any more info than this.  I don't see any permission denied issues in my log files, event viewer or anywhere else.  I'm really at a loss at what could be causing this. 

    Anyone with any insights I'd love to hear from you.

    Thanks in advance,

    -Luke.

    Code snippets…

    My autoword procedure

    Private Sub Command1_Click()

    Dim myRS As New ADODB.Recordset

    Dim usr As String

    Dim MyDll As New localdll.get

    Dim errstr As String

    usr = "myname"

    MyDll.MyMethod errstr, "par1", "par2", myRS, usr

    label1.caption = myRS!value & " - " & myRS!ID

    End Sub

    localdll Method

    PUBLIC Function MyMethod(Errtext, Param1, Param2, myRS, User)

     Dim StrSQL AS String

     StrSQL = "SELECT value, ID FROM MyTable WHERE col1 = " & Param1 & " and col2 = " & Param2

    myrs.open str, cnn, adopenkeyset, adlockoptimistic

    Exitfunction

    Err handling...

    End Function

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • I think you get some more info if you run the profiler against the sql server and catch

    1. Event Class = Security Audit, Event = Audit Login, Login Failed, Audit Object Permission event etc.

    2. Event Class = TSQL, Event = SQL:batch completed, SQL:Statement Completed

    and select the columns Text Data, Login Name and other related columns

    This should help you to see what login Name actually trying to connect to the server when it fails.

  • This has nothing to do with SQL Server...i suspect that since you made changes in your SQL, and NOW the error pops up, you think it is your changes that caused it. Especially since when you run it locally, it works, but in a different environment, it fails.

    error 70 permission denied is returned when VB tries to open a file or write to a file, whether with a FileSystemObject or any other method....the cause of the error is usually one of the following:

    the file is readonly--right click on the file...properties....uncheck the read only checkbox

    it might be that the file does not exist...i thought that gave a different error number, but make sure the file exists.

    security permissions: the account that the program is running under does not have permission to open/edit the file.

    is the file on a network share? can the user running the program actually go to the share or folder where the file is supposed to beopen /edit/save the file? maybe they can't even see the file becuase the path is built and incorrect? (ie. App.Path + myfile.doc is c:\Program Filesmyfile.doc instead of c:\Program Files\myfile.doc )

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Yeah, I've been through all of the files involved, it's word automation that I'm doing, but the manipulation of the word documents are fine.  It's actually one of the calls to my DDL's that make calls to my database that I'm having some issues with.  The user I'm working with right now to make sure there are no permissions errors has Admin rights on the local client machine, Admin rights on the remote application server, and dbo/SA rights on the database/db instance.  that's what confuses me the most.  I can't figure out how to raise the permissions any higher.  I've given that user everything except for Domain admin rights to try and figure out what's goign on here.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • If the problem is caused by the file being written then I think you're looking in the wrong place. The account it uses is not the file of the person using the system, it's the account that IIS is running in, check that the IIS account has permissions to read/write on the folder in question.

  • The file is written properly, it's saved renamed and reopened correctly.  The problem comes after it's already been reopened and I'm calling my other Dll's to pull in data to populate the document with.  BTW, this is all happeneing onthe local client machine and not on the server.  That's why there is an application proxy installed onthe local machine.

    Thanks.

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • ahh was this web based? i didn't see that.

    I can tell you the error 70 is coming from vb or asp, because there is no error 70 fro SQL server to return.

    the error is definately file system based.

    It might be true that a step after your DDL is raising the error when it tries to write to a file that does not exist, or a file that is read only.

    select top 3 * from sysmessages where error=70

    no results.......

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Okay, so it's running a local DCOM on the box, which should still be running under the local IIS but regardless that isn't the problem. It sounds as though the file once created and opened isn't being shut down again so IIS has locked it. Can you delete the file manually? If not then it's been locked as it hasn't been closed properly after it was opened.

  • gotcha; if the file is open, then Word has an exclusive file lock on the document.

    The fix is to always use a COPY of the file every time...

    so you might have a word doc Template.Doc, and you copy it as a new file every time....if the file is going to be manipulated again, you copy the copy of the file;

    ie

    Dim objFSO

    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

    objFSO.CopyFile App.Path & "\Template.Doc"), App.Path & "\TemplateCopy47.Doc", True

    'do work on copy47 in automated word

    'word closes the file with the .save command

     

    'get another copy of it for a second word instances to fiddle with it.objFSO.CopyFile App.Path & "\TemplateCopy47.Doc"), App.Path & "\TemplateCopy91.Doc", True

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • It's not the word doc that I'm having issues with.  I think it's the other dll I'm having issues with.  the line of code that errors and returns my error is

    MyDll.MyMethod errstr, "par1", "par2", myRS, usr

    If I put a msgbox in front and directly after this line of code, I see the first message box, but never see the second because it errors out.

    I'm not actually manipulating the word document at this time.  I'm just filling a recordset with data so that I can fill my bookmarks a bit further down my code.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • Any chance of you posting the MyMethod part of the COM?

  • I did, it's at the end of my first post, but here it is again...

    localdll Method

    PUBLIC Function MyMethod(Errtext, Param1, Param2, myRS, User)

     Dim StrSQL AS String

     StrSQL = "SELECT value, ID FROM MyTable WHERE col1 = " & Param1 & " and col2 = " & Param2

    myrs.open str, cnn, adopenkeyset, adlockoptimistic

    Exitfunction

    Err handling...

    End Function

    and yeah yeah, Dynamic SQL not so great I know, I've been replacing it as I go, but there's just soooo much of it, and since I can't get this to work right now anyhow I'm not touching it just yet.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply