Select * from participant_details where Datefrm>='" + Datefrm1 + "' and DateTo<='" + DateTo1 + "' ", vCon);
da.Fill(dt);
here Datefrm1 and DateTo1 are Datetimepickers values
i didn't get correct result when I use the above code
please solve my problem
Reagards
NagaRaju

Sanjeeb LenkaPosted Jul 26, 2013, 8:33 AM
string Sql = "Select * from participant_details where Datefrm>=@Datefrm and DateTo<=@DateTo";
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.Parameters.AddWithValue("@Datefrm",SqlDbType.DateTime).Value= Datefrm1;
cmd.Parameters.AddWithValue("@DateTo",SqlDbType.DateTime).Value= DateTo1;
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
Iftikar HussainPosted Jul 26, 2013, 8:27 AM
Try like this
Regards,
Iftikar