在报表Sharp Shooter中连接到sql server ce [英] connecting to sql server ce in report sharp shooter

查看:62
本文介绍了在报表Sharp Shooter中连接到sql server ce的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用C#中的程序并在sql server ce中使用主从表.
但是我不知道如何在报表Sharp Shooter中连接到sql server ce?
如果有人拥有与此相关的源代码或程序.

谢谢u

i''m using a program in C# and use master-detail tables in sql server ce.
but i no know how to connecting to sql server ce in report sharp shooter?
if someone have source code or program about this Put here.

thank u

推荐答案

1.要使用数据库,我们需要可以从Microsoft网站下载的一组SQL Server Compact Edition库: http://img593.imageshack.us/img593/617/59588125.png
3.编写一个函数,该函数将用数据库中的数据填充数据集:
1. To work with the database we need the SQL Server Compact Edition set of libraries which can be downloaded from Microsoft website: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=17439
2. Add the reference to the project to take advantage of the SqlCEDataAdapter functionality. http://img593.imageshack.us/img593/617/59588125.png
3. Write a function which will fill a dataset with the data from the database:
1.	private void PrepareDataSet()
2.	        {
3.	            string connectionString = "Data Source = db.sdf";
4.	            SqlCeConnection connection = new SqlCeConnection(connectionString);
5.	            connection.Open();
6.	 
7.	            string query = "SELECT * FROM Person";
8.	            SqlCeDataAdapter dataAdapter = new SqlCeDataAdapter(query, connection);
9.	 
10.	            dataAdapter.Fill(dataSet1);
11.	}



4.将对PrepareDataSet方法的调用添加到构造函数 http://img829.imageshack.us/img829/4720/98959194.png

5.现在,数据库中的数据可以在报告中使用 http://img717.imageshack.us/img717/9241 /85692839.png



4. Add the call for the PrepareDataSet method to the constructor http://img829.imageshack.us/img829/4720/98959194.png

5. Now the data from the database are available in a report http://img717.imageshack.us/img717/9241/85692839.png


看看他们的网站,他们说它支持使用您的应用程序支持的任何.Net数据源".

我建议您看一下他们的网站:他们提供免费和付费支持,并且会比您更好地了解您的产品和使用方式! http://www.perpetuumsoft.com/Support.aspx?lang=zh_CN [ ^ ]
Looking at their website, they say it supports "use of any .Net data sources supported by your application" so it should do.

I would suggest that you look at their website: they offer support both free and paid, and will understand thier product and hoiw you use it a lot better than we would! http://www.perpetuumsoft.com/Support.aspx?lang=en[^]


我使用解决方案2
这个报告来源
i use Solution 2
and this source for report
string connectionString = @"Data Source=C:\data\Shop1.sdf";
               SqlCeConnection connection = new SqlCeConnection(connectionString);
               connection.Open();
               string query = "SELECT * FROM Customers";
               SqlCeDataAdapter dataAdapter = new SqlCeDataAdapter(query, connection);
               dataAdapter.Fill(shop1DataSet1);
           try
           {
               reportGenerator1.Prepare();
               using (NineRays.Reporting.View.PreviewForm previewForm = new NineRays.Reporting.View.PreviewForm(reportGenerator1))
               {
                   previewForm.WindowState = FormWindowState.Maximized;
                   previewForm.ShowDialog(this);
               }
           }
           catch (Exception ee)
           {
               MessageBox.Show(ee.Message, "Report Sharp-Shooter", MessageBoxButtons.OK, MessageBoxIcon.Error);
           }



然后运行程序并看到以下内容:
http://freepicupload.com/view.php?filename=232p1 .png [^ ]

然后单击刷新报告"并看到此
http://freepicupload.com/view.php?filename=679p2 .png [^ ]

为什么要报告为空?!2



then run program and saw this:
http://freepicupload.com/view.php?filename=232p1.png[^]

then click to Refresh report and saw this
http://freepicupload.com/view.php?filename=679p2.png[^]

why report empty?!!2


这篇关于在报表Sharp Shooter中连接到sql server ce的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆