By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,660 Members | 1,103 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,660 IT Pros & Developers. It's quick & easy.

After 2003 to 2005 Upgrade Wizard, Getting System.Security.SecurityException

P: n/a
microsoft.public.dotnet.languages.vb.upgrade isn't getting much
traffic, so I'll try here.

Ours is a VB6 shop exploring .NET.

First I wrote a new application with VB .NET 2003 to create a pdf
Crystal Report from a SQL Server 2000 table. I followed advice from
the MSDN article "Add Professional Quality Reports to Your Application
with Visual Studio .NET"
(http://msdn.microsoft.com/msdnmag/is...2/05/Crystal/), and it
worked fine.

Then we got in VB .NET 2005, and I tried to open this solution
there, with the idea of deploying it as our first .NET server app in a
few days. The Wizard seemed to take it from 2003 to 2005 with no
problem, and I get a clean build. However, when I run, I can't connect
to the test SQL Server I've been using even though I am an
administrator.

Here's the code:

Friend WithEvents scnSQLConnection As _
System.Data.SqlClient.SqlConnection
Friend WithEvents sdaDataAdapter As _
System.Data.SqlClient.SqlDataAdapter
Friend WithEvents ndsMain As MySolutionName.MyDatasetClassName
.. . .
Public Sub FrmThatHasCrystalViewer_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
scnSQLConnection.ConnectionString = _
"Persist Security Info=False;Integrated Security=SSPI;database=" & _
"MyDatabase;server=OurTestSQLServer2000"
sdaDataAdapter.Fill(ndsMain)

It fails on the line above and, in the immediate window, I get:

A first chance exception of type 'System.Security.SecurityException'
occurred in System.Data.dll

When I click on view detail, I get:

System.Security.SecurityException was unhandled
Message="Request for the permission of type
'System.Data.SqlClient.SqlClientPermission,
System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed."
Source="mscorlib" . . .

The dialog box suggests clicking on "Add Permission to the Project." I
did that, and get a dialog box saying "The new permission has been
added to your application. However, the change will not take effect
until the debugging session is restarted."

Restart the debugging session, same problem again. Go all the way of
VS and back in again, still same problem. Reboot, same problem.

I could deploy the VS 2003 build, but it would be nice to start off
with a consistent current version inventory, not to mention that I
would like to understand more.

All ideas and suggestions will be appreciated.

Steve Eisenberg
Pennsylvania U.S.A.

Apr 9 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

I have heard of people having problems connecting to sql server 2000
with vb express. The work around is to use the oledb classes instead of the
sqlclient classes. There are example connection strings on
connectionstrings.com

http://www.connectionstrings.com/

Ken
-------------------

"ei****@gmail.com" wrote:
microsoft.public.dotnet.languages.vb.upgrade isn't getting much
traffic, so I'll try here.

Ours is a VB6 shop exploring .NET.

First I wrote a new application with VB .NET 2003 to create a pdf
Crystal Report from a SQL Server 2000 table. I followed advice from
the MSDN article "Add Professional Quality Reports to Your Application
with Visual Studio .NET"
(http://msdn.microsoft.com/msdnmag/is...2/05/Crystal/), and it
worked fine.

Then we got in VB .NET 2005, and I tried to open this solution
there, with the idea of deploying it as our first .NET server app in a
few days. The Wizard seemed to take it from 2003 to 2005 with no
problem, and I get a clean build. However, when I run, I can't connect
to the test SQL Server I've been using even though I am an
administrator.

Here's the code:

Friend WithEvents scnSQLConnection As _
System.Data.SqlClient.SqlConnection
Friend WithEvents sdaDataAdapter As _
System.Data.SqlClient.SqlDataAdapter
Friend WithEvents ndsMain As MySolutionName.MyDatasetClassName
.. . .
Public Sub FrmThatHasCrystalViewer_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
scnSQLConnection.ConnectionString = _
"Persist Security Info=False;Integrated Security=SSPI;database=" & _
"MyDatabase;server=OurTestSQLServer2000"
sdaDataAdapter.Fill(ndsMain)

It fails on the line above and, in the immediate window, I get:

A first chance exception of type 'System.Security.SecurityException'
occurred in System.Data.dll

When I click on view detail, I get:

System.Security.SecurityException was unhandled
Message="Request for the permission of type
'System.Data.SqlClient.SqlClientPermission,
System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed."
Source="mscorlib" . . .

The dialog box suggests clicking on "Add Permission to the Project." I
did that, and get a dialog box saying "The new permission has been
added to your application. However, the change will not take effect
until the debugging session is restarted."

Restart the debugging session, same problem again. Go all the way of
VS and back in again, still same problem. Reboot, same problem.

I could deploy the VS 2003 build, but it would be nice to start off
with a consistent current version inventory, not to mention that I
would like to understand more.

All ideas and suggestions will be appreciated.

Steve Eisenberg
Pennsylvania U.S.A.

Apr 9 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.