Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

unable to access database from code module of report viewer (.rdlc) and vs 2010

$
0
0

Hi Everyone,

   I am unable to run an .rdlc report from aspx page. I am having code in the code module to make a column into hyperlink in that report. It is trying to connect to database from within code. When I run the report I am getting the following error:

The report references the code module 'system.data version = 2.0.0.0 culture = nuetral...' which is not a trusted assembly.

 The report code is as follows:

Public Shared Function OpenMEO(ByVal inMEO As String) As String
Dim rootWebConfig As System.Configuration.Configuration
    rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/ESSGateKeeper")
Dim strConnString As System.Configuration.ConnectionStringSettings
       strConnString.ConnectionString = rootWebConfig.ConnectionStrings.ConnectionStrings("AEMESS001DEVConnectionString").ConnectionString
        Dim con As New System.Data.SqlClient.SqlConnection(strConnString.ConnectionString)
        Dim qry = "Select MEOPATH from dbo.udf_GetMEOpath(@inMEO)"
       ' Dim cmd As New System.Data.SqlClient.SqlCommand(qry, con)
Dim cmd As New System.Data.SqlClient.SqlCommand
cmd.CommandText =  "Select MEOPATH from dbo.udf_GetMEOpath(@inMEO)"
cmd.Parameters.AddWithValue("@inMEO", inMEO)
  Dim MPath As String
  'cmd.CommandType = System.Data.SqlClient.SqlCommand.CommandType.Text
        'cmd.Parameters.AddWithValue("@inMEO", inMEO)
        Try
            con.Open()

            MPath = cmd.ExecuteScalar()
           Catch ex As Exception
            Throw ex
        Finally
            con.Close()
            con.Dispose()

        End Try
        Return MPath
    End Function

Can anyone please help me. I appreciate any help you can give me. Regards, Suma

 

 


Viewing all articles
Browse latest Browse all 4737

Trending Articles