G
Guest
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.
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.