HI
I used dropdownlists and datalist and button in my page
I select from 3 DDL Startdate and I select from other 3 DDL Enddate and when I click on button in datalist show data from database that date are between Startdate and End DAte
below is code
protected void Btn_Click(object sender, EventArgs e)
{
DateTime startDate = new DateTime(int.Parse(DDLYear.SelectedItem.Text), int.Parse(DDLMonth.SelectedItem.Text), int.Parse(DDLDay.SelectedItem.Text));
DateTime endDate = new DateTime(int.Parse(DDLYearE.SelectedItem.Text), int.Parse(DDLMonthE.SelectedItem.Text), int.Parse(DDLDayE.SelectedItem.Text));
SqlCommand _cmd = new SqlCommand("searchPic", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
_cmd.Parameters.AddWithValue("@StartDate", startDate);
_cmd.Parameters.AddWithValue("@EndDate", endDate);
_cn.Open();
SqlDataReader _dr = _cmd.ExecuteReader();
if (_dr.HasRows)
{
DataList1.DataSource = _dr;
DataList1.DataBind();
}
_cn.Close();
And SP
ALTER procedure [dbo].[searchPic]
@StartDate DATETIME
,@EndDate DATETIME
AS
BEGIN
select Name,BehCode,Date from House_p
WHERE [Date] BETWEEN @StartDate AND @EndDate
END
problem is that I bind DDL from database that show persian date like 1391-1392-1393 and ...
and In database save date with English format (2012/02/20) in below thread told me that I should save persian date into database
DATE
but I want know is there any way that when I click on button at first it change persian date into English date after that It send @Startdate And @Enddate parameters to SP?
BestRegards