473,396 Members | 1,917 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.

SqlClientPermission error

mmb
hi all
i used this below function to connect to sql server 2k

[SqlClientPermission (SecurityAction.Assert ,Unrestricted=true)]
private void button1_Click(object sender, System.EventArgs e)
{
try
{
SqlClientPermission myPerm = new SqlClientPermission(PermissionState.Unrestricted);
myPerm.Assert();
myPerm.AllowBlankPassword=true;
string str;
str= "data source=sniper;initial catalog=newzolf;persist security info=False;user id=zolf;" +
"password=1;packet size=4096";
SqlConnection cnn=new SqlConnection(str);
SqlCommand cmd=new SqlCommand("select * from article",cnn);
cnn.Open();
MessageBox.Show("3");
DataSet ds=new DataSet();
MessageBox.Show("4");
SqlDataAdapter da=new SqlDataAdapter(cmd);
MessageBox.Show("5");
da.Fill(ds);
MessageBox.Show("Sucess");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
when run application on own computer work truly
but when copy the EXE file to shred folder this error accoured

Request for the permission of type System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.

why this error accour?

"i am used SqlClientPermission "

thanx in advance.
Jul 21 '05 #1
3 4450
mmb <my***@yahoo.com> wrote:
<snip>
Request for the permission of type
System.Data.SqlClient.SqlClientPermission, System.Data,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed.

why this error accour?


When you run code from the network, by default it won't be trusted as
much as purely local apps. If you want to change that, go into your
administrative tool for the computer and change the .NET configuration.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
Thanx for your answe
but how can set .net SqlClientPermission in runtime
my code not wor
[SqlClientPermission (SecurityAction.Assert ,Unrestricted=true)
private void button1_Click(object sender, System.EventArgs e

tr

SqlClientPermission myPerm = new SqlClientPermission(PermissionState.Unrestricted)
myPerm.Assert();
myPerm.AllowBlankPassword=true
string str
str= "data source=sniper;initial catalog=newzolf;persist security info=False;user id=zolf;"
"password=1;packet size=4096"
SqlConnection cnn=new SqlConnection(str)
SqlCommand cmd=new SqlCommand("select * from article",cnn)
cnn.Open()
MessageBox.Show("3")
DataSet ds=new DataSet()
MessageBox.Show("4")
SqlDataAdapter da=new SqlDataAdapter(cmd)
MessageBox.Show("5")
da.Fill(ds)
MessageBox.Show("Sucess")

catch(Exception ex

MessageBox.Show(ex.Message)

Jul 21 '05 #3
mmb
Thanx for your answe
but how can set .net SqlClientPermission in runtime
my code not wor
[SqlClientPermission (SecurityAction.Assert ,Unrestricted=true)
private void button1_Click(object sender, System.EventArgs e

tr

SqlClientPermission myPerm = new SqlClientPermission(PermissionState.Unrestricted)
myPerm.Assert();
myPerm.AllowBlankPassword=true
string str
str= "data source=sniper;initial catalog=newzolf;persist security info=False;user id=zolf;"
"password=1;packet size=4096"
SqlConnection cnn=new SqlConnection(str)
SqlCommand cmd=new SqlCommand("select * from article",cnn)
cnn.Open()
MessageBox.Show("3")
DataSet ds=new DataSet()
MessageBox.Show("4")
SqlDataAdapter da=new SqlDataAdapter(cmd)
MessageBox.Show("5")
da.Fill(ds)
MessageBox.Show("Sucess")

catch(Exception ex

MessageBox.Show(ex.Message)


Jul 21 '05 #4

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

Similar topics

1
by: Jay W NOjwalkerSPAM | last post by:
I have some class objects each in separate projects that belong to a solution. The projects reference one another within that solution. The 'main' function calls the other procedure/function...
1
by: Dave | last post by:
I have a ASP.net application that work fine with IIS 5.0. I'm trying to put it on IIS 6.0. And getting the following error. ASP is enable It is in a virtual directory - I also follow the...
4
by: António Pinho | last post by:
Hi, I have a big problem with an webpart/assembly. i'm trying to connect to sql server but i get the error "Request for the permission of type System.Data.SqlClient.SqlClientPermission,...
3
by: mmb | last post by:
hi all i used this below function to connect to sql server 2k private void button1_Click(object sender, System.EventArgs e) { try { SqlClientPermission myPerm = new...
0
by: apramodk | last post by:
environmnet : VB.NET (.Net 2.0) I am trying run a windows application from a Network. While connecting to SQL Server, I get the following error. Request for the permission of type...
1
by: goc | last post by:
I have a Web Farm, that fetches its database-data from a separate database-server. Today I was forced to go over to .NET 2.0 (since 1.1 can't be installed on Windows Vista x64), and it brought...
0
by: sumguyb | last post by:
I've written a Windows application using VB and Visual Studio 2005. I've used the Data Application Block in the Microsoft Enterprise Library 2.0 to make all of my SQL calls. The application runs...
1
by: sumguyb | last post by:
I've written a Windows application using VB and Visual Studio 2005. I've used the Data Application Block in the Microsoft Enterprise Library 2.0 to make all of my SQL calls. The application runs...
0
by: JoaquimC | last post by:
Hello all, I've a C# application connecting to a SQL Server 2005 DataBase and it all works well in development ambient. I'm developing with Visual Studio 2005 and i can connect to the DataBase...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.