sql - C# cant populate datagridview -


i had similar problem , shown how fix it, tried post on same thread limited.

i have method private void filllevyroll(), put method in button on click event fill datagridview dgvlevyroll problem when run not getting error , dgv remaining empty.im lost confused tried no avail.

the query works in sql management studio

 private void filllevyroll()     {         try         {             datatable datatablesource = new datatable();               sqlcommand command = new sqlcommand("select  refrence" +                 ", max(case when accnumber = '1010000' amount end) opening" +                 ", max(case when accnumber = '1010000' amount end) electricity" +                 ", max(case when accnumber = '1045000' amount end) water" +                 ", max(case when accnumber = '1000000' amount end) levy" +                 ", max(case when accnumber = '2750000' amount end) interest" +                 ", max(case when accnumber = '4000000' amount end) legal" +                 ", max(case when accnumber = '4350003' amount end) other" +                 ", max(case when accnumber = '8400000' amount end) payments" +                 ", max(case when accnumber = '1000000' amount end) due" +                 " dbo.vw_ledgertransactions" +                 " group refrence ", conn);              sqldataadapter adapter = new sqldataadapter(command);             conn.open();              adapter.fill(datatablesource);             dgvlevyroll.datasource = datatablesource;          }         catch (exception ex)         {             messagebox.show("application error. err:" + ex.tostring());         }                 {             conn.close();         }      } 


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -