Hello sir,
I have a problem in search values in ms access datebase searching date wise
search a values is date wise ex: 4/1/2012 to 4/30/2012 but it's shows some datavalues are missing i attached the screen short below the word document
but i searched value is ex: 4/1/2012 to 5/1/2012 it's correctly view of month wise full data values
Kindly please reffer my word doc with clear screen short
my search button code is
private void button1_Click(object sender, EventArgs e)
{
double sum1 = 0, sum2 = 0, netbal = 0;
int j = 0;
//string str = "select * from purmonth where purchasedate between ('" + textBox2.Text + "')and ('" + textBox3.Text + "') and cusid = ('" + comboBox1 .Text + "') or paiddate between ('" + textBox4.Text + "') and ('" + textBox5.Text + "') and cusid = ('" + comboBox1 .Text + "')";
string str = "select * from SalesMonth where SaleDate between ('" + dateTimePicker1.Text + "')and ('" + dateTimePicker2.Text + "') and SalecustomerID = ('" + comboBox1.Text + "') or PaidDate between ('" + dateTimePicker3.Text + "') and ('" + dateTimePicker4.Text + "') and SalecustomerID = ('" + comboBox1.Text + "')";
com = new OleDbCommand(str, con);
DataSet vds = new DataSet();
OleDbDataAdapter vda = new OleDbDataAdapter(com);
vda.Fill(vds, "res");
dataGridView1.DataSource = vds.Tables["res"];
for (int i = 0; i < dataGridView1.Rows.Count; ++i)
{
sum1 += Convert.ToInt32(dataGridView1.Rows[i].Cells[9].Value);
}
for (int i = 0; i < dataGridView1.Rows.Count; ++i)
{
sum2 += Convert.ToInt32(dataGridView1.Rows[i].Cells[8].Value);
}
j = dataGridView1.Rows.Count - 1;
dataGridView1.Rows[j].Cells[9].Value = sum1.ToString("n");
dataGridView1.Rows[j].Cells[8].Value = sum2.ToString("n");
netbal = sum1 - sum2;
dataGridView1.Rows[j].Cells[10].Value = netbal.ToString("n");
dataGridView1.Rows[j].Cells[5].Value = "TOTAL";
vda.Dispose();
com.Dispose();
i have attached the code with screen short
kindly help me
thinking you