Um...A DateTimePicker.Value property is a DateTime - so parsing it as an
int
is going to fail:
public FRM_RPT_Car_Details_Date_end(DateTime x)
{
InitializeComponent();
this.x = int.Parse(x);
}
The attempt will throw an exception, if it compiled...which it wouldn't as there is no overload which accepts a DateTime parameter.
Instead, store it as a DateTime:
DateTime x;
...
public FRM_RPT_Car_Details_Date_end(DateTime x)
{
InitializeComponent();
this.x = x;
}
And use a parameterized query to pass it to SQL:
s = "select cars.Car_id,Job_card,convert(varchar,s1.Change_date,101) as Change_date ,convert(varchar,Reload_License.Car_E_date_Licen,101) as Car_E_date_Licen, Service_Type.Servce_desc, Current_dist,Prev_distance as Prev_dist,value_Tashhem as Value from Tashhem inner join cars on Tashhem.Car_id= Cars.Car_id inner join Service_Type on Tashhem.Servce_id = Service_Type.Servce_id inner join Reload_License on Cars.Car_id = Reload_License.Car_id where Reload_License.Car_E_date_Licen = @Date";
DataSet_Car_Details_end_date ds = new DataSet_Car_Details_end_date();
SqlDataAdapter dataAdapter = new SqlDataAdapter(s, con);
dataAdapter.SelectCommand.Parameters.AddWithValue("@Date", x);