最初,我在我的ssis C#脚本任务中定义了commandtext,该任务计算了表A的行数。现在我需要再添加两个commandtext来计算表b和C中的行因为我需要在我的自定义电子邮件中包含该查询的输出。如何在SSIS中创建多个命令文本c#
try
{
dbConnection.Open();
if (dbConnection.State == ConnectionState.Open)
{
OleDbCommand dbCommand = dbConnection.CreateCommand();
dbCommand.CommandType = CommandType.Text;
dbCommand.CommandText = "select count(*) as Total_Source from [dbo].A";
dbCommand.CommandText = "select count(*) as Total_Destination from [dbo].B";
dbCommand.CommandText = "select count(*) as Total_Blank from [dbo].C where ColumnA = ''";
OleDbDataReader dbReader = dbCommand.ExecuteReader();
if (dbReader.HasRows)
dtResults.Load(dbReader);
string theSum = dtResults.Rows[0]["Total_Source"].ToString();
string theSum1 = dtResults.Rows[0]["Total_Destination"].ToString();
//string theSum2 = dtResults.Rows[0]["Count_Blank"].ToString();
我相信我需要为表B和C(这在上面的脚本中是不正确的)定义命令文本,但我不知道该怎么做。
感谢任何帮助!
我没有成功追加较早尝试... –
我认为返回值被前面的查询结果覆盖,你需要分开每个查询并单独执行 – LONG