Hi guys,

I am working on a small project in C# and MySql. The part of code below is not bringing out the report. I am using Microsoft reportviewer. What could be wrong?

private void detailedToolStripMenuItem_Click(object sender, EventArgs e)
        {
          
          DataTable dadt = new DataTable();
          MySqlDataAdapter dad = new MySqlDataAdapter();
          dad = new MySqlDataAdapter("select staff.companyname,concat(firstname,' ',lastname,' ',surname)as staffname,loan.staffnumber,loannumber,SUBSTR(loan.STARTDATE,1,10)as startdate,concat(paymonth,' ',payyear)as payperiod,adddate(loan.startdate,interval repaymentperiod month) as duedate,loan.interestrate,loan.interestamount,loan.loanbalance,(principalamount+interestamount) as totalamount,loan as amount from staff,loan,salarytransactions where staff.staffnumber=salarytransactions.staffnumber and salarytransactions.staffnumber=loan.staffnumber", cn);
           
 MySqlCommandBuilder mbuilder = new MySqlCommandBuilder(dad);

            dadt = new DataTable();
            dad.Fill(dadt);
            reportFunction("Payroll.Loanstatement.rdlc", "companyloan_DataTable1", dadt);
        }

Recommended Answers

All 4 Replies

Did you ever got error messages?

No error message. It is running for about 3 secs and then returns nothing. Not even a blank page

Put break point at line #13 and check whether a query populate any row or not.

I have put the breakpoint at ln 13 , but the report function does not call the report page for results display; instead it is returning to the main form after hitting F10 key twice. However, The query returns records when run manually in the database.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.