private void BindDates() { DateTime FromDate = DateTime.Now.ToUniversalTime().AddHours(5.5); TxtFromDate.Text = FromDate.ToString("yyyy/MM/dd"); DateTime ToDate = DateTime.Now.ToUniversalTime().AddHours(5.5); TxtToDate.Text = ToDate.ToString("yyyy/MM/dd"); } protected void databind() { string[] strFromDate = TxtFromDate.Text.Split('/'); string[] strToDate = TxtToDate.Text.Split('/'); DateTime fromDate = Convert.ToDateTime(strFromDate[1] + '/' + strFromDate[2] + '/' + strFromDate[0]); DateTime toDate = Convert.ToDateTime(strToDate[1] + '/' + strToDate[2] + '/' + strToDate[0]); con.Open(); MySqlCommand com = new MySqlCommand("SELECT * FROM processeddata_table WHERE dialdate BETWEEN '" + fromDate + "' AND '" + toDate + "' ", con); { DataTable ds = new DataTable(); MySqlDataAdapter da = new MySqlDataAdapter(com); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); con.Close(); da.Dispose(); ds.Dispose(); } } protected void Button1_Click(object sender, EventArgs e) { databind(); } }
TRUE
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)