when i run my code i get this error message
"Failed to convert parameter value from a SqlParameter to a DateTime."
& i couldn't find what is wrong..... here's my code
and my 2 parameters in the stored proceduers are
@datefrom datetime, @dateto datetime
thx in advance
"Failed to convert parameter value from a SqlParameter to a DateTime."
& i couldn't find what is wrong..... here's my code
Code:
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection thisConnection = new SqlConnection
(thisConnectionString);
DataSet thisDataSet = new DataSet();
thisConnection.Open();
DateTime from= new DateTime();
DateTime to = new DateTime();
from = DateTime.Parse(TextBox1.Text);
to = DateTime.Parse(TextBox2.Text);
ReportViewer1.Visible = true;
SearchValue[0] = new SqlParameter
("@datefrom",SqlDbType.DateTime);
SearchValue[0].Value = from;
SearchValue[1] = new SqlParameter("@dateto",
SqlDbType.DateTime);
SearchValue[1].Value = to;
ReportViewer1.LocalReport.ReportPath
="Report.rdlc";
thisDataSet = SqlHelper.ExecuteDataset
(thisConnection, "GetAllMissingItems",SearchValue);
ReportDataSource datasource = new
ReportDataSource("BA2DataSet_GetAllMissingItems",
thisDataSet.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add
(datasource);
ReportViewer1.LocalReport.Refresh();
}
@datefrom datetime, @dateto datetime
thx in advance