0
我正在嘗試使用ODBC驅動程序創建MariaDB的Upsert,但是我遇到了更新部分的問題。我找不到用ODBC更新單行的組件。帶有ODBC驅動程序的SSIS Upsert
我試圖腳本組件,但我不能讓它proberly運行(C#是不是我的套件)。
public override void Eingabe0_ProcessInputRow(Eingabe0Buffer Row)
{
ConnectionManagerOdbc mariaDbConnection = (ConnectionManagerOdbc)base.Connections.OTRSDB;
System.Data.SqlClient.SqlConnection sqlConn = (System.Data.SqlClient.SqlConnection) mariaDbConnection.AcquireConnection(null);
System.Data.SqlClient.SqlCommand sqlComm;
sqlConn.Open();
String sqlCommand = "UPDATE xdwdata.Contracts " +
"SET " +
" reference = " + Row.reference.ToString() +
" customer = " + Row.customer.ToString() +
" contract = " + Row.contract.ToString() +
" status = test " + Row.status.ToString() +
" change_date = " + Row.changedate.ToString() +
" WHERE " +
" id = " + Row.id.ToString() +
" AND client = " + Row.client.ToString();
sqlComm = new System.Data.SqlClient.SqlCommand(sqlCommand, sqlConn);
sqlComm.ExecuteNonQuery();
mariaDbConnection.ReleaseConnection(sqlConn);
}
有人可以指向我的錯誤?
另一個問題是:是否可以在PreExecute方法中創建Connection,因此我不打開和關閉每個Row的連接?
你會得到什麼錯誤信息? –