Delphi7+水晶报表9+SQL Server2000代码类似:
    Crpe1.ReportName :=aReportName;
    crpe1.Connect.ServerName :=aReportServer;
    crpe1.Connect.DatabaseName := aDatabaseName;
    crpe1.Connect.UserID :='sa';
    crpe1.Connect.Password :='apass';
    crpe1.Connect.Propagate :=true;
    Crpe1.Execute;但是发现数据库服务器可以动态修改,但数据库改不了,
要改变只能在水晶报表,打开其它数据库再刷新,然后再保存RPT文件才能生效.
crpe1.Connect.DatabaseName := aDatabaseName;这句话无效啊这给部署带来很大的不便,是不是我上面的写的不太对?
恳请高人指导,多谢!

解决方案 »

  1.   


    to: nevergetwin(头球冲顶),怎么断啊,能说明白点么?
      

  2.   

    delphi下没用过水晶报表,不过在c#中可以,DELPHI中应该也可以。一段C#的代码
    using CrystalDecisions.Shared;
    using CrystalDecisions.CrystalReports.Engine;{   TableLogOnInfo log = new TableLogOnInfo();
       log.ConnectionInfo.ServerName = "wudi";
       log.ConnectionInfo.DatabaseName = "Mydatabase";
       log.ConnectionInfo.UserID = "asp.net";
       log.ConnectionInfo.Password = "exit";
       ReportDocument rd = new ReportDocument();
       string RptPath = null;
       
       RptPath =Server.MapPath("CrystalReport2.rpt");
       rd.Load(RptPath);
       rd.Database.Tables[0].ApplyLogOnInfo(log);   this.CrystalReportViewer1.ReportSource = rd;   this .CrystalReportViewer1.DataBind();}
      

  3.   

    没用过,就是把connected、active属性之类的设为fasle,再动态设置,试试
      

  4.   

    crpe1.Connect.Free;
     crpe1.Connect.Destroy;
     crpe1.Connect.Clear;
     都会导致异常出错,晕
      

  5.   

    to:xinyukc03() crpe1.Connect.close没这个方法啊有经验的大虾们,请指点啊,急死啦!