Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

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:
C#
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. 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
 
Share this answer
 
v2
Comments
aref136790 22-Mar-12 7:37am    
thanks kovalev599
but this pics is filter in my location.
if u can ، send me.

mail: aref_zd@yahoo.com
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[^]
 
Share this answer
 
i use Solution 2
and this source for report
C#
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);
           }


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
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900