Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
SQL
ce
clients
clustering
connect
datamining
datawarehouse
dts
fulltext
jdbcdriver
msde
mseq
newusers
notificationsvcs
odbc
olap
programming
replication
reportingsvcs
security
securitytools
server
setup
sqlxml.viewmapper
tools
xml
  
 
date: Tue, 9 Sep 2008 01:11:31 -0700 (PDT),    group: microsoft.public.sqlserver.reportingsvcs        back       


Reporting Service 2005 external assemblies using   
I've used the external assemblies for the retrieving information from
the DB. If i have a connection string as hard coded, it's no problem,
but i need to change the connection string and i try to use
application settings file "app.config"; When i execute the report i've
got the message "Object reference not set to an instance of an
object".

Sample code that i used for the assemblies:
    public class My
    {
        public static string MyMethod()
        {
            SqlConnection sqlConnection = new SqlConnection();

            SqlClientPermission permission =
                new
SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);

            try
            {
                sqlConnection.ConnectionString =
ConfigurationManager.ConnectionStrings["connection"].ToString();
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
            return sqlConnection.ConnectionString;

        }
    }

Config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="connection" connectionString="connection string"/>
  </connectionStrings>
</configuration>

Who know how i can solve this probelm?
date: Tue, 9 Sep 2008 01:11:31 -0700 (PDT)   author:   kostak

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us