0

ループを使用して、C# で記述された SSIS パッケージを介して多数の SSRS レポートを実行しようとしています。問題は、以下のコードが初期パラメータ パス スルーに基づいて 1 つのファイルしか生成しないことです。問題は、 ConnectionManager と HttpClientConnection が再利用されていることだと思います。これを行う他の方法はありますか?

        for (int i = 0; i <= cust.GetUpperBound(0); i++)
        {
            string varDate = System.DateTime.Now.ToString("dd/MM/yyyy");
            string d1ThisMOnth = System.DateTime.Today.AddDays(-(DateTime.Today.Day - 1)).ToString();
            var today = DateTime.Today;
            var month = new DateTime(today.Year, today.Month, 1);
            var first = month.AddMonths(-1);
            var last = month.AddDays(-1);
            string reportfilename = @"D:\Reports\AllActiveAccounts_" + month.ToString("MMyyyy") + "_" + cust[0, 0] + "." + cust[0, 4];
            string url = @"http://" + cust[i, 5] + "/ReportServer?/" + cust[i, 0] + "/Report&rs:Command=Render&location=" + cust[i, 1] + "&clityp=" + cust[i, 2] + "&acctyp=" + cust[i, 3] + "&startdate=" + first.ToString("MM/dd/yyyy") + "&enddate=" + last.ToString("MM/dd/yyyy") + "&rs:Format=" + cust[i, 4] + "&rc:Toolbar=False";
            ConnectionManager httpConn = Dts.Connections["ReportServer"];
            HttpClientConnection clientConn = new HttpClientConnection(httpConn.AcquireConnection(null));
            clientConn.ServerURL = url;
            clientConn.DownloadFile(reportfilename, true);
        }
4

1 に答える 1

2

少し推測ですが、もしそうなら。reportfilenameパラメーターでループカウンターを使用していないためだと思います。ファイル名の行を以下のように変更してみてください。

string reportfilename = @"D:\Reports\AllActiveAccounts_" + month.ToString("MMyyyy") + "_" + cust[i, 0] + "." + cust[i, 4];
于 2013-08-13T16:42:32.273 に答える