sql server programming:
I've just started to integrate a VB.net assembly into an SQL-SERVER database
I've brought in the assembly and created an SQL procedure which finds its
way to the VB code
It all worked fine while I was just handling simple commands to test it out
but now I've added some database accessing and I get errors
If anyone has any ideas about how to solve this I'd be very grateful
Phil
---------------------------------------------------------------------------------------
my VB code followed by the exception raised when I try to run this from
SQL-SERVER
....
Partial Public Class EOL
<Microsoft.SqlServer.Server.SqlProcedure()> _
Public Shared Sub ProjectUpdate(ByVal projectID As Integer)
Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim rdr As SqlDataReader
Dim constr As String="Data Source=oakleafserver\sqlexpress;Initial
Catalog=estimatingOnLine;Integrated Security=True"
conn = New SqlConnection(constr)
conn.Open()
cmd = New SqlCommand("Select * from Projects_items", conn)
rdr = cmd.ExecuteReader()
SqlContext.Pipe.Send(rdr)
conn.Close()
SqlContext.Pipe.Send("Hello from VB ")
End Sub
....
Msg 6522, Level 16, State 1, Procedure ProjectUpdate, Line 0
A .NET Framework error occurred during execution of user defined routine or
aggregate 'ProjectUpdate':
System.Security.SecurityException: Request for the permission of type
'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
System.Security.SecurityException:
at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.PermissionSet.Demand()
at System.Data.Common.DbConnectionOptions.DemandPermission()
at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection
outerConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at estimatingOnLine.EOL.ProjectUpdate(Int32 projectID)