Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
i want to print 1 record on my data gird view to the crystal report but i don't know how to do that i tried some methods but i only got to print all the data

What I have tried:

so this is my code to the crystal report
C#
private void Print_Click(object sender, EventArgs e)
       {

           Print print = new Print();
           print.ShowDialog();
           if (conect.State!=ConnectionState.Open)
           {
               conect.Open();
           }
           string cs = "select * from Sign_Up";
           OleDbCommand command = new OleDbCommand(cs,conect);
           OleDbDataAdapter adap = new OleDbDataAdapter(command);
           DataSet dt = new DataSet();
           adap.Fill(dt, "Sign_Up");
           CrystalReport1 crs1 = new CrystalReport1();
           crs1.SetDataSource(dt);
           print.crystalReportViewer1.ReportSource = crs1;
           conect.Close();
           print.crystalReportViewer1.Refresh();

it print all the data in the data grid view but i want to print the user i chose
i am useing access data base
any one have suggestions ?
thanks
Posted
Updated 11-Mar-19 0:22am
v2

Change this line to "customize" your query; currently, it's selecting "all" (*)
string cs = "select * from Sign_Up";
 
Share this answer
 
I changed the line to this but it did not show anything
C#
string cs = "select [ID],[UserName],[Item_Name],[Price] from Sign_Up";
 
Share this answer
 

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