<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    靈魂-放水

    為學日益,為道日損。

    BlogJava 首頁 新隨筆 聯(lián)系 聚合 管理
      296 Posts :: 10 Stories :: 274 Comments :: 0 Trackbacks

     WinForm:           
                    this.crystalReportViewer1.ReportSource = this.customerByLivingPlace1;
                    // 數(shù)據(jù)庫Login
                  
                    foreach (CrystalDecisions.Shared.IConnectionInfo connection in this.customerByLivingPlace1.DataSourceConnections)
                    {
                        connection.SetConnection("localhost", "Real_EstatePC", "**", "**");
                    }
                    this.crystalReportViewer1.Refresh();
               // 子報表的Login
                 foreach (CrystalDecisions.CrystalReports.Engine.ReportDocument sr in document.Subreports)
                 {
                     foreach (CrystalDecisions.Shared.IConnectionInfo connection in this.customerByLivingPlace1.DataSourceConnections)
                     {
                          connection.SetConnection("localhost", "Real_EstatePC", "**", "**");
                     }
                 }


    注:customerByLivingPlace1指向rpt。


    WebForm:
     首先,為了登錄方便,將數(shù)據(jù)庫的用戶名和密碼先寫到Web.config中:
    <appSettings>
        <add key="DBServerName" value="你的數(shù)據(jù)庫服務(wù)器" />
        <add key="DBUserID" value="sa" />
        <add key="DBPassWord" value="UU1Tc3lzdGVt" />
    </appSettings>

    然后寫個類來統(tǒng)一驗證登錄
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Configuration;

    namespace BLL
    {
        public class LoginCrystalReport
        {        
            public void Login( CrystalDecisions.CrystalReports.Engine.ReportDocument report)
            {
                string serverName=ConfigurationManager.AppSettings["DBServerName"];
                string userId = ConfigurationManager.AppSettings["DBUserID"];

                string passWord=ConfigurationManager.AppSettings["DBPassWord"];
               
                //Set Database Logon to main report
                foreach (CrystalDecisions.Shared.IConnectionInfo connection in report.DataSourceConnections)
                {
                    if (connection.ServerName == serverName)
                    {
                        connection.SetLogon(userId, passWord);
                    }
                }

                //Set Database Logon to subreport
                foreach (CrystalDecisions.CrystalReports.Engine.ReportDocument subreport in report.Subreports)
                {
                    foreach (CrystalDecisions.Shared.IConnectionInfo connection in subreport.DataSourceConnections)
                    {
                        if (connection.ServerName == serverName)
                        {
                            connection.SetLogon(userId, passWord);
                        }
                    }
                }
            }

           
        }
    }

    posted on 2007-04-26 17:01 放水老倌 閱讀(1992) 評論(0)  編輯  收藏 所屬分類: .NET打印報表
    主站蜘蛛池模板: 久久亚洲精品中文字幕三区| 亚洲av永久无码精品网址| 亚洲A∨精品一区二区三区| 91精品免费久久久久久久久| 一二三四免费观看在线电影| 羞羞视频免费网站在线看| 亚洲av无码专区在线电影| 亚洲国产综合人成综合网站00| 亚洲日韩v无码中文字幕| 日批日出水久久亚洲精品tv| 在线看片人成视频免费无遮挡| 亚洲精品免费在线观看| 亚洲一级片免费看| 色吊丝性永久免费看码| 美女被爆羞羞网站在免费观看| 亚洲精品自偷自拍无码| 亚洲一区二区久久| 亚洲欧洲尹人香蕉综合| 91亚洲精品第一综合不卡播放| 国产亚洲综合一区柠檬导航| 国产亚洲AV手机在线观看| 亚洲日本韩国在线| 亚洲精品老司机在线观看| 亚洲av无码国产精品色在线看不卡 | 国产色爽女小说免费看| 台湾一级毛片永久免费| 国产午夜精品久久久久免费视| 国产免费福利体检区久久| 国产精品成人啪精品视频免费| 男女男精品网站免费观看 | 免费精品国产自产拍观看| 免费无码黄动漫在线观看| 成人免费午夜视频| 女人18毛片a级毛片免费| 女人被男人躁的女爽免费视频| 24小时日本在线www免费的| 午夜两性色视频免费网站| 国产高清视频在线免费观看| 日本免费一区尤物| 亚洲精品尤物yw在线影院| 国产成人精品日本亚洲专区|