RAJESH KUMAR

RAJESH KUMAR

  • NA
  • 3
  • 1.5k

How to fill datagridview date wise and show total in row

Jun 17 2016 10:44 AM
Datagridview
 
Hello sir this is my requirement i want to fill data grid view date wise and show total in rows.
 
This is my code...
 
 
private void loadTotal()
{
try
{
SQLiteConnection myAccessConn = GetConn();
myAccessConn.Open();
string sql = "SELECT *From builtyViews ORDER BY gr_no DESC";
SQLiteDataAdapter dataadapter = new SQLiteDataAdapter(sql, myAccessConn);
DataSet ds = new DataSet();

myAccessConn.Close();

dataadapter.Fill(ds, "builtyViews");
//dataGridView1.DataSource = ds;
dataGridView1.DataMember = "builtyViews";
dataGridView1.DataSource = ds;
dataGridView1.Update();
dataGridView1.Refresh();
dataGridView1.ReadOnly = true;
dataGridView1.Sort(dataGridView1.Columns[3], ListSortDirection.Descending);
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView1.Columns[1].HeaderText = "Party Name";
dataGridView1.Columns[3].HeaderText = "GR No.";
dataGridView1.Columns[4].HeaderText = "GR Date";
dataGridView1.Columns[21].HeaderText = "Bill Value";
dataGridView1.Columns[21].DefaultCellStyle.Format = "N2";
this.dataGridView1.Columns[21].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
dataGridView1.Columns[1].Width = Screen.PrimaryScreen.WorkingArea.Width - 650;
dataGridView1.Columns[4].Width = 150;
dataGridView1.Columns[21].Width = 200;
dataGridView1.Columns[0].Visible = false;
dataGridView1.Columns[2].Visible = false;
for (int i = 5; i <= 24; i++)
{
dataGridView1.Columns[i].Visible = false;
}
dataGridView1.Columns[21].Visible = true;
}
catch (Exception ex)
{
navigationControl.Enabled = false;
MessageBox.Show("Error found ! Contact administrator");
exitToolStripMenuItem.Enabled = true;
}
}

 
 

Answers (1)