1
Answer

How to fill datagridview date wise and show total in row

Photo of RAJESH KUMAR

RAJESH KUMAR

8y
330
1
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)

0
Photo of Karthik Kumar
NA 182 23.1k 9y
yes.i am using windows 8 and  VS 2013 updated this code working in windows phone8.0 but not in 8.1
0
Photo of Afzaal Ahmad Zeeshan
NA 36k 2m 9y
Perhaps that assembly is not found, are you sure the framework is installed correctly? The problem would be caused if the framework is not installed properly, or if you are trying to install the application compiled for a latest release on a previous system.