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

    <bdo id='zw2CP'></bdo><ul id='zw2CP'></ul>

    <tfoot id='zw2CP'></tfoot>
    1. <small id='zw2CP'></small><noframes id='zw2CP'>

    2. <legend id='zw2CP'><style id='zw2CP'><dir id='zw2CP'><q id='zw2CP'></q></dir></style></legend>
    3. 如何在 C# 中将 SQL Server Compact Edition 数据库连接到 Crystal Report

      How to connect SQL Server Compact Edition database to Crystal Report in C#(如何在 C# 中将 SQL Server Compact Edition 数据库连接到 Crystal Report)
      • <bdo id='Oopue'></bdo><ul id='Oopue'></ul>
        <legend id='Oopue'><style id='Oopue'><dir id='Oopue'><q id='Oopue'></q></dir></style></legend>

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

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

                  <tbody id='Oopue'></tbody>
              • <tfoot id='Oopue'></tfoot>
                本文介绍了如何在 C# 中将 SQL Server Compact Edition 数据库连接到 Crystal Report的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试将我的 SQL Server Compact Edition 数据库连接到 Crystal Report.我整天都在搜索,到目前为止,我在其他网站上发现了很多与之相关的问题,但没有一个有效的答案.

                I'm trying to connect my SQL Server Compact Edition database to Crystal Report. I've been searching all day long and I've found many question related to it so far on other websites, but none had a working answer.

                我还发现 这个问题在这个网站上要求 VB.Net 解决方案.还有这个链接互联网,并且有一种令人困惑的方式通过 XML 来实现,我无法弄清楚.

                I also found this question in this site which has asked for VB.Net solution. And this link which is all over the internet and has a confusing way to do it by XML, which I couldn't figure it out.

                SQL Server 和 Access 中的其他解决方案链接没有帮助.

                There are other links with solutions in SQL Server and Access which don't help.

                • SQL Server 解决方案
                • 访问解决方案

                我想知道是否有一种简单的方法可以将 SQL Server CE 数据库连接到真正有效的 Crystal Report?

                I'm wondering is there a simple way to connect a SQL Server CE database to Crystal Report which actually works?

                推荐答案

                感谢这个有用的代码项目示例

                我将演示一个更简单的示例,以便更容易理解.

                I will demonstrate an easier sample to make it easier to figure it out.

                1. 创建一个 Winform 并向其添加一个按钮和一个 CrystalReportViewer 控件.

                使用解决方案资源管理器中的 add -> New Items 将数据集(*.xsd 文件)添加到您的项目.之后,将 DataTable 添加到 DataSet.

                Add a DataSet (*.xsd file) to your project using add -> New Items in solution explorer. After that, add a DataTable to the DataSet.

                1. 将列添加到 DataTable.最好将它们命名为与您要在报告中显示的列相同的名称.列数取决于 Crystal 报表中应显示的列数.

                1. Add columns to DataTable. It's better to name them the same as the columns you are going to display on your report. The number of columns depends on how many columns should be displayed in the Crystal report.

                使用add -> New Items 将Crystal Report 添加到项目中,使用报表向导,选择Project 数据源的ADO.NET DataSets 作为Crystal Report 的数据源,并选择你刚刚的数据表在您的 DataSet 中创建,作为 Crystal Report 的选定表.

                Add a Crystal Report into the project using add -> New Items and using the Report Wizard, choose ADO.NET DataSets of the Project data source as the data source of the Crystal Report and select the data table you just created in your DataSet, as the selected table of the Crystal Report.

                1. 点击完成,您的列将自动添加到CrystalReport中.

                进入按钮点击事件,在里面写下这些代码.

                Go to the button click event and write these codes in it.

                private void btnGo_Click(object sender, EventArgs e)
                {
                    CrReport2 objRpt = new CrReport2();
                    string query = "Select Name,Number from tblInfo";  //Your sql query
                    SqlCeConnection conn =
                        new SqlCeConnection(
                           @"Data Source=|DataDirectory|myDB.sdf;Persist Security Info=False"); //Your connection
                
                    SqlCeDataAdapter adepter = new SqlCeDataAdapter(query, conn);
                    DsReport Ds = new DsReport(); //DsReport is my dataset
                
                    adepter.Fill(Ds, "customer"); //customer is my datatable in dataset
                
                    objRpt.SetDataSource(Ds);
                    crystalReportViewer1.ReportSource = objRpt;
                }
                

              • 享受你的报告:)

              • Enjoy your report :)

                这篇关于如何在 C# 中将 SQL Server Compact Edition 数据库连接到 Crystal Report的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                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 帮助器中提取显示名称和描述属性)
                C# Attributes and their uses(C# 属性及其用途)
                C# - Getting all enums value by attribute(C# - 按属性获取所有枚举值)

                <tfoot id='63s2J'></tfoot>
                    <bdo id='63s2J'></bdo><ul id='63s2J'></ul>

                    <small id='63s2J'></small><noframes id='63s2J'>

                    <legend id='63s2J'><style id='63s2J'><dir id='63s2J'><q id='63s2J'></q></dir></style></legend>

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