<i id='sHiPa'><tr id='sHiPa'><dt id='sHiPa'><q id='sHiPa'><span id='sHiPa'><b id='sHiPa'><form id='sHiPa'><ins id='sHiPa'></ins><ul id='sHiPa'></ul><sub id='sHiPa'></sub></form><legend id='sHiPa'></legend><bdo id='sHiPa'><pre id='sHiPa'><center id='sHiPa'></center></pre></bdo></b><th id='sHiPa'></th></span></q></dt></tr></i><div id='sHiPa'><tfoot id='sHiPa'></tfoot><dl id='sHiPa'><fieldset id='sHiPa'></fieldset></dl></div>

      <legend id='sHiPa'><style id='sHiPa'><dir id='sHiPa'><q id='sHiPa'></q></dir></style></legend>

      <tfoot id='sHiPa'></tfoot>

      <small id='sHiPa'></small><noframes id='sHiPa'>

        • <bdo id='sHiPa'></bdo><ul id='sHiPa'></ul>
      1. 带有水晶报表的数据库登录提示

        database login prompt with crystal reports(带有水晶报表的数据库登录提示)
        • <i id='7BfJK'><tr id='7BfJK'><dt id='7BfJK'><q id='7BfJK'><span id='7BfJK'><b id='7BfJK'><form id='7BfJK'><ins id='7BfJK'></ins><ul id='7BfJK'></ul><sub id='7BfJK'></sub></form><legend id='7BfJK'></legend><bdo id='7BfJK'><pre id='7BfJK'><center id='7BfJK'></center></pre></bdo></b><th id='7BfJK'></th></span></q></dt></tr></i><div id='7BfJK'><tfoot id='7BfJK'></tfoot><dl id='7BfJK'><fieldset id='7BfJK'></fieldset></dl></div>
            <tbody id='7BfJK'></tbody>

        • <tfoot id='7BfJK'></tfoot>
              <bdo id='7BfJK'></bdo><ul id='7BfJK'></ul>

                <small id='7BfJK'></small><noframes id='7BfJK'>

                1. <legend id='7BfJK'><style id='7BfJK'><dir id='7BfJK'><q id='7BfJK'></q></dir></style></legend>
                  本文介绍了带有水晶报表的数据库登录提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试显示一些 report,其中包含一些 subreports,但每次显示报告时都会抛出一些对话框,询问数据库连接.我正在使用此代码:

                  I'm trying to display some report with some subreports inside it, but every it shows the report it throws some dialog box asking for database connection. I'm using this code:

                  private void frmReporte_Load(object sender, System.EventArgs e)
                      {
                          Clave = ConfigurationSettings.AppSettings["Password"].ToString();
                          NombreBD = ConfigurationSettings.AppSettings["CatalogBD"].ToString();
                          NombreServidor = ConfigurationSettings.AppSettings["Servidor"].ToString(); ;
                          UsuarioBD = ConfigurationSettings.AppSettings["UserID"].ToString();
                          this.crtReportes.ReportSource = this.prepareReport();
                      }
                      public void imprimirReporte()
                      {
                          ReportDocument rpt = new ReportDocument();
                          rpt.Load(mvarRutaReporte);
                          rpt.SetDataSource(clsReportes.dsReporte);
                          rpt.PrintToPrinter(1, false, 1, 1);
                      }
                      private ReportDocument prepareReport()
                      {
                          Sections crSections;
                          ReportDocument crReportDocument, crSubreportDocument;
                          SubreportObject crSubreportObject;
                          ReportObjects crReportObjects;
                          ConnectionInfo crConnectionInfo;
                          Database crDatabase;
                          Tables crTables;
                          TableLogOnInfo crTableLogOnInfo;
                          crReportDocument = new ReportDocument();
                          crReportDocument.Load(RutaReporte);
                          crReportDocument.SetDataSource(clsReportes.dsReporte.Tables[0]);
                          crDatabase = crReportDocument.Database;
                          crTables = crDatabase.Tables;
                          crConnectionInfo = new ConnectionInfo();
                          crConnectionInfo.ServerName = NombreServidor ;
                          crConnectionInfo.DatabaseName = NombreBD;
                          crConnectionInfo.UserID = UsuarioBD;
                          crConnectionInfo.Password = Clave;
                          foreach (CrystalDecisions.CrystalReports.Engine.Table aTable in crTables)
                          {
                              crTableLogOnInfo = aTable.LogOnInfo;
                              crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
                              aTable.ApplyLogOnInfo(crTableLogOnInfo);
                          }
                          // Para los reportes que poseen subreportes 
                          // pongo el objeto seccion del la seccion actual del reporte 
                          crSections = crReportDocument.ReportDefinition.Sections;
                          // busco en todas las secciones el objeto reporte
                          foreach (Section crSection in crSections)
                          {
                              crReportObjects = crSection.ReportObjects;
                              //busco en todos los reportes por subreportes
                              foreach (ReportObject crReportObject in crReportObjects)
                              {
                                  if (crReportObject.Kind == ReportObjectKind.SubreportObject)
                                  {
                                      crSubreportObject = (SubreportObject)crReportObject;
                                      //abro el subreporte y me logeo con los datos del reporte general
                                      crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);
                                      crDatabase = crSubreportDocument.Database;
                                      crTables = crDatabase.Tables;
                                      foreach (CrystalDecisions.CrystalReports.Engine.Table aTable in crTables)
                                      {
                                          crTableLogOnInfo = aTable.LogOnInfo;
                                          crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
                                          aTable.ApplyLogOnInfo(crTableLogOnInfo);
                                      }
                                  }
                              }
                          }
                          return crReportDocument;
                      }
                  

                  推荐答案

                  我遇到了类似的问题,现在已经解决了,所以我添加了这个回复,以防它可能对我遇到的其他人有所帮助.

                  I had a similar problem and it is solved now, so I'm adding this reply in case it might help someone else in my situation.

                  在为报告设置 SQL Server 登录信息时,请确保包含 服务 名称.因此,例如,请确保您为 Crystal 提供myservermyservice",而不仅仅是myserver".

                  When setting the SQL Server login info for the report, make sure you include the service name. So, for example, make sure you're giving Crystal "myservermyservice" instead of just "myserver".

                  我的程序能够仅使用myserver"从 SQL Server 访问数据,但需要为 Crystal 提供myservermyservice".

                  My program is able to access data from SQL Server using just "myserver", but Crystal needs to be given "myservermyservice".

                  这篇关于带有水晶报表的数据库登录提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Performance overhead of using attributes in .NET(在 .NET 中使用属性的性能开销)
                  Accessing attribute info from DTE(从 DTE 访问属性信息)
                  c# Hide a property in datagridview with datasource(c#使用数据源隐藏datagridview中的属性)
                  Extract Display name and description Attribute from within a HTML helper(从 HTML 帮助器中提取显示名称和描述属性)
                  How can I force the PropertyGrid to show a custom dialog for a specific property?(如何强制 PropertyGrid 显示特定属性的自定义对话框?)
                  Associate attribute with code generated property in .net(将属性与 .net 中的代码生成属性相关联)

                      <bdo id='2FCgh'></bdo><ul id='2FCgh'></ul>
                        1. <i id='2FCgh'><tr id='2FCgh'><dt id='2FCgh'><q id='2FCgh'><span id='2FCgh'><b id='2FCgh'><form id='2FCgh'><ins id='2FCgh'></ins><ul id='2FCgh'></ul><sub id='2FCgh'></sub></form><legend id='2FCgh'></legend><bdo id='2FCgh'><pre id='2FCgh'><center id='2FCgh'></center></pre></bdo></b><th id='2FCgh'></th></span></q></dt></tr></i><div id='2FCgh'><tfoot id='2FCgh'></tfoot><dl id='2FCgh'><fieldset id='2FCgh'></fieldset></dl></div>
                          <tfoot id='2FCgh'></tfoot>
                        2. <small id='2FCgh'></small><noframes id='2FCgh'>

                              <tbody id='2FCgh'></tbody>

                            <legend id='2FCgh'><style id='2FCgh'><dir id='2FCgh'><q id='2FCgh'></q></dir></style></legend>