Reputation: 839
I am new to Windows Desktop Application Development.
I have two tables in Access 2007 database.
First is the "Bill Master" and the second is "Bill Detail"
I want to print the bill from my application using the report viewer control.
How do I accomplish this?
Please help.
Upvotes: 0
Views: 805
Reputation: 1786
Take a look at this video to get to know how to create a report viewer control. Moreover, you will need to bind your data from the access database using e.g. this function
public void LoadDatabase()
{
string connectionString = String.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};", yourDatabaseName);
using (OleDbConnection con = new OleDbConnection(connectionString))
{
try
{
con.Open();
var data = new DataSet();
OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM A", con);
adapter.Fill(data, "a");
adapter = new OleDbDataAdapter("SELECT * FROM B", con);
adapter.Fill(data, "b");
// TODO: bind the control's data source to dataset
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
Upvotes: 1