Table - tblData (Data for Jan.): This is how I see the data with
select * from tblData ID Tag Date
1 OB 2014-07-01
2 OC 2014-07-01
3 AB 2014-07-01
Trying to acheive the same from C#, but this is not working.
C#: DateTime dtFrom =
Convert.ToDateTime(txtFromDate.Text.Trim(),System.Globalization.CultureInfo.GetCultureInfo
("hi-IN").DateTimeFormat);
DateTime dtTo =
Convert.ToDateTime(txtToDate.Text.Trim(),System.Globalization.CultureInfo.GetCultureInfo
("hi-IN").DateTimeFormat);
gridview1.DataSource = objDAL.GetData(dtFrom,dtTo);
gridview1.DataBind();
Stored Procedure(sql server 2008 r2):Alter Procedure GetData
(
@DateFrom Date,
@DateTo Date
)
As
Begin
Select * from tblData
where date between @DateFrom and @DateTo
End
The only date in table is Jan 7,2014. The SP works fine when I tested with
execute GetData '2014-07-01','2014-07-01' (yyyy-dd-mm).
But from webpage, Even if i enter '08-01-2014' & '08-01-2014' (dd-mm-yyyy),in the textboxes, I get all records..!!! –