Populate a package variable with a result set using Execute SQL Task.
Write a SQL query, set the ResultSet property to Full result set and configure a package variable in the Result Set property window.The package variable’s type is System.Object.
Following code in a script task retrieves the number of records in the result set.
System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter();
DataTable dt = new DataTable();
da.Fill(dt, Dts.Variables["User::JobTitles"].Value);
MessageBox.Show(dt.Rows.ToString());
Write a SQL query, set the ResultSet property to Full result set and configure a package variable in the Result Set property window.The package variable’s type is System.Object.
Following code in a script task retrieves the number of records in the result set.
System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter();
DataTable dt = new DataTable();
da.Fill(dt, Dts.Variables["User::JobTitles"].Value);
MessageBox.Show(dt.Rows.ToString());
No comments:
Post a Comment