I downloaded this project and database but when I run it I get this error, Can you please help me to fix this? I really appreciate your help.
I have attached the source code and database, please take a look. https://gofile.io/d/9TZvQV Thank you!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;
namespace DBApplication
{
public partial class frmBilling : Form
{
SqlConnection con;
SqlDataAdapter da;
SqlCommand com;
SqlDataReader dreader;
DataSet ds;
DataTable dt;
DataRow dr;
string sql;
int quantity;
ReportDataSource rds;
ReportParameterCollection repParams;
public frmBilling()
{
InitializeComponent();
string constr = ConfigurationManager.ConnectionStrings["constr"].ToString();
con = new SqlConnection(constr);
loadCategory();
}
private void loadCategory()
{
sql = "SELECT CategoryID,CategoryName FROM Categories";
da = new SqlDataAdapter(sql, con);
ds = new DataSet();
da.Fill(ds, "Categories");
dt = ds.Tables["Categories"];
dr = dt.NewRow();
dr[0] = "-1";
dr[1] = "--Select Category--";
dt.Rows.InsertAt(dr, 0);
cmbCategory.DisplayMember = "CategoryName";
cmbCategory.ValueMember = "CategoryID";
cmbCategory.DataSource = dt;
}
Based on the advice from Michael and my test on your project, please install -nuget package Microsoft.Reporting.WinForms.v11
to solve your problem.