Showing all records from a dataset in report viewer

I am trying to write a report for my VB project using reportviewer. It prepares invoice for customers and therefore needs to print each customers detail on a new page but at the same time. When I load it after dropping the fields from the dataset, it shows only the first record. How can I get the rest. OBed Ghana
Posted by Obed 1/31/2016 3:08:57 AM
Total Answers : 1
Answer 1
1. fetch the dataset from the toolbox.
2. Add the tables into the dataset from designer view.
3. Drop the report viewer on the form.
4. Add the following code on the page_load event

try
{

OleDbConnection cn = new OleDbConnection(connectionstring);
cn.Open();
OleDbCommand cmd = cn.CreateCommand();
cmd.CommandText = "select * from table_name";
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = cmd;

DataSet1 ds = new DataSet1();
da.Fill(ds, "table_name");


cn.Close();

CheckIn_Bill objRpt = new CheckIn_Bill();
objRpt.SetDataSource(ds);
DataRow dr = ds.Tables["checkintable"].Rows[0];

crystalReportViewer1.ReportSource = objRpt;
crystalReportViewer1.Refresh();
}
catch (Exception ex)
{
MessageBox.Show("Error Occured : " + ex);
}

I hope you get an idea from here.. if not then ask me in detail...
Posted by StepCoder Team 2/4/2016 10:57:48 PM
Post your answer
Preview
Sign in to your account
Your Email : 
Password :   
Forgot your password
Don't have StepCoder account ?
Create a new account
 
Follow me on twitter
About Me
Harpreet Singh
I began programming with C++ when i was 17. Then at the middle of my study .NET came. Then I began to read C# and VB.NET. By the time i learnt SQL and ASP.NET, and developed some websites such as news portals that are active now. Currently i am running my own Software company.
Answer these questions! If you know the answer.