"Request for the permission of type
'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
I have used this connection string before with no problems...what am I
overlooking here?
Thanks,
Ron
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;
namespace GeneralTesting
{
class DataClass
{
public SqlConnection SqlConn = new SqlConnection();
public void setConnections()
{
String ConnectionString = "Data Source=TestServer; Integrated Security=SSPI;
Initial Catalog=master";
SqlConn.ConnectionString = ConnectionString;
SqlConn.Open();
}
public DataSet getEmployees(string CompanyID)
{
string strSelectSql = "SELECT FirstName, LastName FROM [" + CompanyID +
"].[dbo].[Employee]";
SqlCommand selectSqlCommand = new SqlCommand(strSelectSql, SqlConn);
SqlDataAdapter sqlData = new SqlDataAdapter(selectSqlCommand);
DataSet dsSelectData = new DataSet();
sqlData.Fill(dsSelectData);
return dsSelectData;
}
}
}
Initialization:
DataClass DC = new DataClass();
DC.setConnections();
DataSet DS = DC.getEmployees("00010145");
Do you happen to run this from a network drive? Then you have to adapt your
code access security settings (CAS) for the share your code resides on, by
default, applications loaded from a network resource cannot access SQL
server. Check MSDN for the caspol utility for more info.
Willy.
I am perplexed.
"Willy Denoyette [MVP]" <willy.d...@telenet.be> wrote in message
news:OinWNHWF...@TK2MSFTNGP14.phx.gbl...
"RSH" <way_bey...@yahoo.com> wrote in message
news:OWhfyBWF...@tk2msftngp13.phx.gbl...
>
I am still in quite a pickle here. I have read something on Strong naming
my assemblies...I tried to follow along but I was not able to make sense of
it...I have no DLL files in my project, I was able to make my .snk file but
it gets foggy after that. Is there some sort of Strong naming for Dummies
that I can follow along with? BTW I am running 2.0 framework.
Thanks for any help!
Ron
"RSH" <way_bey...@yahoo.com> wrote in message
news:OWhfyBWF...@tk2msftngp13.phx.gbl...
>
CasPol.exe -m -ag 1.2 -url file://Server/MyShare/* FullTrust
It's also possible to be less generous and create a new code group for this
with less privileges than Full trust.
Willy.
"RSH" <way_bey...@yahoo.com> wrote in message
news:%23y27D%23WFGH...@TK2MSFTNGP10.phx.gbl...
Is this going to be a problem for deployment also? ...or is this just in a
development environment?
Thanks,
Ron
"Willy Denoyette [MVP]" <willy.d...@telenet.be> wrote in message
news:%23FBJWJX...@TK2MSFTNGP09.phx.gbl...