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();
            reportFunction("Payroll.Loanstatement.rdlc", "companyloan_DataTable1", dadt);

Edited by __avd: Added [code] tags. Do wrap your programming code blocks within [code] ... [/code] tags

7 Years
Discussion Span
Last Post by njoros

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


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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.