473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SecurityException was Unhandled

This is code I created to add a record where the user inputs the new
text in textboxes:

Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
City = txtCity.Text
Country = txtCountry.Text
p2005 = txt2005.Text
p2015 = txt2015.Text

Dim dt As New DataTable()
Dim connStr As String = "Provider = Microsoft.Jet.oledb.4.0;"
& "Data Source=F:\Pham\megacities.mdb"
Dim sqlStr As String = "INSERT INTO Cities VALUES('city',
'country', 'p2005', 'p2015')"
Dim dataadapter As New OleDb.OleDbDataAdapter(sqlStr, connStr)
dataadapter.Fill(dt)
dataadapter.Dispose()

End Sub

When I run the program it stops at dataadapter.Fill(dt) and gives me
the error message: Security Exception was Unhandled.

Can anyone help me?

Thanks!

Feb 28 '07 #1
3 1412
Are you running it from a network, or accessing a network resource to load
the database?

If so you may need to change settings on the computer to "Trust" the
assembly

Mike
<jt*****@gmail.comwrote in message
news:11**********************@k78g2000cwa.googlegr oups.com...
This is code I created to add a record where the user inputs the new
text in textboxes:

Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
City = txtCity.Text
Country = txtCountry.Text
p2005 = txt2005.Text
p2015 = txt2015.Text

Dim dt As New DataTable()
Dim connStr As String = "Provider = Microsoft.Jet.oledb.4.0;"
& "Data Source=F:\Pham\megacities.mdb"
Dim sqlStr As String = "INSERT INTO Cities VALUES('city',
'country', 'p2005', 'p2015')"
Dim dataadapter As New OleDb.OleDbDataAdapter(sqlStr, connStr)
dataadapter.Fill(dt)
dataadapter.Dispose()

End Sub

When I run the program it stops at dataadapter.Fill(dt) and gives me
the error message: Security Exception was Unhandled.

Can anyone help me?

Thanks!

Feb 28 '07 #2
where do i go to change it to "trusted"?

Mar 5 '07 #3
In the control panel -microsoft.net configuration wizards icon "Runtime
security policy"

I can not explain the exact steps as I find this console quite complex
myself, but this is where you get it done.

I tend not to run .NET applications from a network share for this reason.

Mike.
<jt*****@gmail.comwrote in message
news:11*********************@n33g2000cwc.googlegro ups.com...
where do i go to change it to "trusted"?

Mar 7 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mark Rodrigues | last post by:
Hi everyone, Today we hit a problem when we rolled a new web-site are were presented with a error on our page that looked like: Security Exception Description: The application attempted to...
1
by: Sam | last post by:
I have a desktop VB.Net application I developed locally. I uploaded it to a file server we have and the .Net Framework is installed on the file server. When I try to run the executable from the...
0
by: James B | last post by:
OMA (Outlook Mobile Access) under Exchange is giving me a System.Security.SecurityException error. From what I gather this is a problem with the security level under which the OMA application is...
9
by: James | last post by:
I have created a console application in C# that appears to not even really get started unless the code group in which it is contained is set to FullTrusted. The Everything permission set does not...
0
by: Brian A | last post by:
I have code that calls some Win32 code. My library is accessed via remoting from a client. In version 1.0 of the framework I had no problems. With 1.1 I consitently get the securityException: ...
7
by: Sabo, Eric | last post by:
We are an educational environment, we are using VB .Net and Windows XP SP2. The users are power users. We have a Visual Basic .Net class that is having trouble with their project, they are getting...
0
by: Seok Bee | last post by:
Dear Experts, I've created a Console application to perform a checking of an Excel file. During development using vb.net in Visual Studio 2005, the application is running fine. I can get my...
0
by: Michael | last post by:
Re: system.security.securityexception The program I have written requires "Full Trust" to run and will throw a security exception if a user tries to load it while working in the Intranet...
0
by: John | last post by:
I write a simple .NET client program that calls Java Web Services. Unfortunately, when it runs, it has error "unhandled exception of type 'System.Security.SecurityException' occured in...
5
by: Ankit Aneja | last post by:
This is my problem. I am using Visual 2003, .Net framework 1.1 and the Application Block I configured the DAAB using the Enterprise Library Configuration now this is the error which is coming ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.