0

我正在尝试使用脚本管理器检查我的路径,我的代码在 App_Code 中,这是我的代码:

public ReportDocument ReportCon(string path)
    {
        ReportDocument cryRpt = new ReportDocument();
        ConnectionInfo info = new ConnectionInfo();
        TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
        Tables CrTables;

        info.ServerName = "192.168.1.200";
        info.DatabaseName = "Track4L";
        info.UserID = "Developers";
        info.Password = "dev01@pps";
        ScriptManager.RegisterStartupScript(this, typeof(Page), "test", "alert('" + path + "');", true);
        cryRpt.Load(path);

        CrTables = cryRpt.Database.Tables;
        foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
        {
            crtableLogoninfo = CrTable.LogOnInfo;
            crtableLogoninfo.ConnectionInfo = info;
            CrTable.ApplyLogOnInfo(crtableLogoninfo);
        }
        return cryRpt;
    }

但我收到以下错误:

 Error The best overloaded method match for 'System.Web.UI.ScriptManager.RegisterStartupScript(System.Web.UI.Page, System.Type, string, string, bool)' has some invalid arguments   D:\DMS\DocumentManagement\Track4L\App_Code\ReportConnection.cs  27  13  D:\...\Track4L\

我不知道这个问题将如何解决

4

1 回答 1

3

我认为您正在将此方法的第一个参数传递给您的类的对象。将调用页面的对象传递给它。我希望你的问题能得到解决。

    public ReportDocument ReportCon(System.Web.UI.Page myPage, string path)
    {
       // your code
       ScriptManager.RegisterStartupScript(myPage, typeof(Page), "test", "alert('" + path + "');", true);

    }
于 2012-04-19T05:04:10.423 回答