c# - How to fix - Cannot find object/table in database error when it actually exists? -
i made console c# app in generate sql insert row table info_table , execute it. when use same c# code (with necessary modifications of course) in ssis, error saying table cannot found.
error: system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.data.sqlclient.sqlexception: invalid object name 'info_table'.
i know there info_table in database , works in console app. so, tried use qualified name in ssis c# script instead of info_table , error went away. why happen , how fix ? doubt if there problem ssis connection string.
my ssis connection string (connection manager ado.net type) -
data source=.;user id=admin;initial catalog=maximdb;persist security info=true;application name=ssis-datareader-{555000d ddd-aaa-bbb-cccceee}localhost.maximdb.admin;
my console app connection string -
"server=(local);database=maximdb;integrated security=sspi;";
the c# objects connect database -
for console c# app -
sqlconnection conn = new sqlconnection(consolestring);
for ssis c# script -
string ssisdbconnmgr = "sample_db";//name of connection manager in ssis, ado.net type connectionmanager connmgr; sqlconnection databaseconn; sqlcommand sqlcmd; connmgr = dts.connections[ssisdbconnmgr]; databaseconn = (sqlconnection)connmgr.acquireconnection(dts.transaction); sqlcmd = new sqlcommand();
it sounds table not using default schema (i.e., besides "dbo").
Comments
Post a Comment