SQLDMO problem with VB.NET

  • I'm having a bit of trouble working with SQLDMO in VB.NET.

    The Background:

    VS.NET 2003 Enterprise Architect, SQLDMO 8.0

    I have set a reference to SQLDMO and am using the 'Imports SQLDMO'. The code compiles correctly and starts to execute as desired until I get to the following:

    server = New SQLDMO.SQLServer

    Or

    server = New SQLDMO.SQLServer2

    Or

    etc...

    At this point my Try..Catch block bombs out with the following exception message:

    System.Security.Permissions.SecurityPermission

    If anyone out there can tell me what I am missing or where I should look, I would really appreciate it. TIA

  • I should have held off on posting this question. I have worked through and found the problem and solved it.

    VS.Net does not fully trust network locations. In my case, my code and binary were being stored to a mapped network drive, so when I went to execute the binary, it would fail when it tried to initialize my first SQLDMO object. Solution for this: move the code to a local (C:\, etc) drive.

    Solution number 2 (I like this one much better):

    Goto Start|Settings|Control Panel|Administrative Tools|Microsoft .NET Framework (or 1.1) Configuration

    1. Open Runtime Security Policy | Machine | Code Groups | All_Code. Right click on Local Intranet Zone and choose New.
    2. Name your Group and hit Next
    3. Select Zone from the condition drop down. Choose Local Intranet for the Zone and hit Next.
    4. Use Existing Permission Set should be selected and choose “FullTrust”.  Hit Next.
    5. Click Finish

    This should get you set up so that VS.Net will trust your code stored on network storage.

     

  • This will be very helpful to me in the future, I'm sure.  Thanks for the posting.

Viewing 3 posts - 1 through 2 (of 2 total)

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