By Radha Khare


2019-04-15 11:04:44 8 Comments

I don't know how to bind dataset with crystal report, although I try by seeing some videos.

I am using VS 2010 SQL SERVER 20080R2 CRYSTAL REPORT 2010

I want to print an invoice from crystal report, for that I managed to design report, but I faced a problem when I code to display last data of SQL server. please complete my code.

here is my table named feereceipt feereceipt table and window form constituting crystalreportviewr form1 design

code and my crystal report report

using System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;
using System.Configuration;
namespace Project22
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                 string cn = System.Configuration.ConfigurationManager.ConnectionStrings["mydb"].ConnectionString;
                SqlConnection con = new SqlConnection(cn);
                con.Open();
                SqlCommand cmd = new SqlCommand ("select * from feereceipt where std_id = max(std_id)",con);
                SqlDataAdapter da = new SqlDataAdapter (cmd);
                //complete my code
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message );
            }

        }
    }
}

0 comments

Related Questions

Sponsored Content

42 Answered Questions

[SOLVED] How to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?

  • 2008-09-29 22:30:28
  • mistrmark
  • 1005386 View
  • 1743 Score
  • 42 Answer
  • Tags:   c# .net excel file-io

13 Answered Questions

[SOLVED] How to enable assembly bind failure logging (Fusion) in .NET

27 Answered Questions

[SOLVED] How do I enumerate an enum in C#?

38 Answered Questions

29 Answered Questions

[SOLVED] How do I generate a random int number?

  • 2010-04-24 23:09:11
  • Rella
  • 2016779 View
  • 1697 Score
  • 29 Answer
  • Tags:   c# random

63 Answered Questions

[SOLVED] How do I calculate someone's age in C#?

  • 2008-07-31 23:40:59
  • Jeff Atwood
  • 542437 View
  • 1742 Score
  • 63 Answer
  • Tags:   c# .net datetime

8 Answered Questions

[SOLVED] How to loop through all enum values in C#?

23 Answered Questions

[SOLVED] How do you give a C# Auto-Property a default value?

31 Answered Questions

[SOLVED] What is a NullReferenceException, and how do I fix it?

4 Answered Questions

[SOLVED] Exporting Large Amounts of Data

Sponsored Content