title: How to fix - Cannot find object/table in database error when it actually exists?
body: <p>I made a console C# app in which I generate SQL to insert a row into a table info_table and then execute it. When I use the same C# code (with necessary modifications of course) in SSIS, I get an error saying that the table cannot be found. </p>
  
  <pre><code>Error: System.Reflection.TargetInvocationException: Exception has 
  been thrown by the target of an invocation. 
  ---&gt; System.Data.SqlClient.SqlException: Invalid object name 'info_table'.
  </code></pre>
  
  <p>I know there is a info_table in my database and it works in the console app. So, I tried to use the fully qualified name in my SSIS C# script instead of just info_table and the error went away. Why does this happen and how do I fix it ? I doubt if there is a problem with my SSIS connection string. </p>
  
  <p><strong>My SSIS connection String (connection manager is ADO.NET type) -</strong> </p>
  
  <pre><code>Data Source=.;User ID=admin;Initial Catalog=MaximDB;Persist 
  Security Info=True;Application Name=SSIS-DataReader-{555000d
  ddd-aaa-bbb-cccceee}LocalHost.MaximDB.admin;
  </code></pre>
  
  <p><strong>My console app connection String -</strong> </p>
  
  <pre><code>"server=(local);database=MaximDB;integrated security=SSPI;";
  </code></pre>
  
  <p><strong>The C# objects to connect to the database -</strong> </p>
  
  <p><strong>For Console C# app -</strong></p>
  
  <pre><code>      SqlConnection conn = new SqlConnection(consoleString);
  </code></pre>
  
  <p><strong>For SSIS C# script -</strong></p>
  
  <pre><code>        String ssisDbConnMgr = "SAMPLE_DB";//Name of the connection 
          manager in SSIS, an ADO.NET type
  
          ConnectionManager connMgr;
          SqlConnection databaseConn;
          SqlCommand sqlCmd;
          connMgr = Dts.Connections[ssisDbConnMgr];
          databaseConn = (SqlConnection)connMgr.AcquireConnection(Dts.Transaction);
          sqlCmd = new SqlCommand();
  </code></pre>