Curbside Coder
Curbside Coder

Reputation: 321

Creating Reports using ReportViewer with Dynamic Dataset and PostgreSQL DB in WPF

I have created a system in VS2012 using C# WPF and PostgreSQL Database. It works great aside from reporting. I am a novice in C# programming and I can't create a simple report. I don't create a Dataset using the wizard, I have a code-behind for my Dataset. The problem is I didn't know how to load it in my ReportViewer. Can you please help me guys?

Here is my code:

public rptRecords()
{
    InitializeComponent();

    NpgsqlConnection iConnect = new NpgsqlConnection("Server = " + myModule.Server + ";Port = " + myModule.Port + ";User ID = " + myModule.UserID + ";Password = " + myModule.Password + ";Database = " + myModule.Database);
    iConnect.Open();
    NpgsqlCommand iQuery = new NpgsqlCommand("Select * from Table1");
    iQuery.Connection = iConnect;
    NpgsqlDataAdapter iAdapter = new NpgsqlDataAdapter(iQuery);
    DataSet iDataSet = new DataSet();
    iAdapter.Fill(iDataSet, "TAG");

    //I wish to add the code to load the ReportViewer here...
}

Please take note that I don't want to use the wizard to create a Dataset, because I created my Dataset using code-behind. Also, I don't want to use Crystal Reports - I want my program to be stand-alone without the help of third-party applications.

Upvotes: 1

Views: 696

Answers (0)

Related Questions