i connect to a database and execute a stored procedure to find rows with dates between the parameters start date and end date. i am using C# and SQL Server.
a date time selector is used to select the required dates. the error that i get is: Arithmetic overflow error converting expression to data type datetime.
SqlConnection conn = new SqlConnection("xxxxxx"
SqlDataAdapter da;
DataSet ds;
SqlParameter workParam;
da = new SqlDataAdapter("stpLOCPYDates", conn);
da.SelectCommand.CommandType = CommandType.StoredProcedure;
workParam = new SqlParameter("@pFromDate", System.Data.SqlDbType.DateTime);
workParam.Direction = ParameterDirection.Input;
workParam.Value = dtsStartDate.SelectedDate.Date;
da.SelectCommand.Parameters.Add(workParam);
workParam = new SqlParameter("@pToDate", System.Data.SqlDbType.DateTime);
workParam.Direction = ParameterDirection.Input;
workParam.Value = dtsEndDate.SelectedDate.Date;
da.SelectCommand.Parameters.Add(workParam);
ds = new DataSet();
da.Fill(ds, "dbo.SSRFACC"
dgSales.DataSource = ds;
dgSales.DataBind();
a date time selector is used to select the required dates. the error that i get is: Arithmetic overflow error converting expression to data type datetime.
SqlConnection conn = new SqlConnection("xxxxxx"
SqlDataAdapter da;
DataSet ds;
SqlParameter workParam;
da = new SqlDataAdapter("stpLOCPYDates", conn);
da.SelectCommand.CommandType = CommandType.StoredProcedure;
workParam = new SqlParameter("@pFromDate", System.Data.SqlDbType.DateTime);
workParam.Direction = ParameterDirection.Input;
workParam.Value = dtsStartDate.SelectedDate.Date;
da.SelectCommand.Parameters.Add(workParam);
workParam = new SqlParameter("@pToDate", System.Data.SqlDbType.DateTime);
workParam.Direction = ParameterDirection.Input;
workParam.Value = dtsEndDate.SelectedDate.Date;
da.SelectCommand.Parameters.Add(workParam);
ds = new DataSet();
da.Fill(ds, "dbo.SSRFACC"
dgSales.DataSource = ds;
dgSales.DataBind();