G
Guest
Hi,
I'm getting boring and boring with my ado.net code.
I want to write a little vb.net console application that connect to a remote
SQL Server.
I'm using the following code :
Dim cObjConn As SqlClient.SqlConnection
cObjConn = New SqlClient.SqlConnection("Initial
Catalog=myCatalog;UID=mySQLUser;Password=****;Data Source=myServer")
cObjConn.Open()
And every time I run this code, I got the following error on the .open() :
System.Security.SecurityException: Request for the permission of type
System.Dat
a.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0,
Culture=neutra
l, PublicKeyToken=b77a5c561934e089 failed.
at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
granted
Set, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken
permT
oken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken,
CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames,
Int32
unrestrictedOverride)
at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
cap, S
tackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.Data.SqlClient.SqlConnectionString.Demand(SqlConnectionString
const
r)
at System.Data.SqlClient.SqlConnection.Open()
I've found a very little example in the VB.Net reskit to connet to
SQLServer. I've updated connection string to connect to my server and it's
works. I really don't know where I'm wrong.
Please help me before I or my computer go throw the window of my office.
Regards
Cyril
I'm getting boring and boring with my ado.net code.
I want to write a little vb.net console application that connect to a remote
SQL Server.
I'm using the following code :
Dim cObjConn As SqlClient.SqlConnection
cObjConn = New SqlClient.SqlConnection("Initial
Catalog=myCatalog;UID=mySQLUser;Password=****;Data Source=myServer")
cObjConn.Open()
And every time I run this code, I got the following error on the .open() :
System.Security.SecurityException: Request for the permission of type
System.Dat
a.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0,
Culture=neutra
l, PublicKeyToken=b77a5c561934e089 failed.
at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
granted
Set, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken
permT
oken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken,
CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames,
Int32
unrestrictedOverride)
at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
cap, S
tackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.Data.SqlClient.SqlConnectionString.Demand(SqlConnectionString
const
r)
at System.Data.SqlClient.SqlConnection.Open()
I've found a very little example in the VB.Net reskit to connet to
SQLServer. I've updated connection string to connect to my server and it's
works. I really don't know where I'm wrong.
Please help me before I or my computer go throw the window of my office.
Regards
Cyril