Dear all Here iam unable to get correct output what i need.Actually what out put i need is i want to display the rows in DataGridView in between two days.Here syntax concept is "select * from tokendetails where Software_1createddate between XXXXXX and XXXXX".(tokendetails is the table name)For this i wrote code as
string a, b;a = DateTime.Today.AddDays(-35).ToShortDateString (); b = DateTime.Today.AddDays(-20).ToShortDateString(); MessageBox.Show(a); MessageBox.Show(b);(\\ Here i got the dates which are the boundaries for my output)string st = "select * from tokendetails where software_1createddate between " + a + " and " + b + ""; SqlDataAdapter da = new SqlDataAdapter(st ,con ); DataSet ds = new DataSet();
da.Fill(ds, "tokendetails");
dataGridView1.DataSource = ds.Tables["tokendetails"]; While running this code i got output as data table without any information.In datatable software_1createddate column is in the formate of datetime.In table the date is available in between the two dates also.
Could you please check and suggest the correct code for my need.Thank in advance.