表的最佳重载方法匹配(字符串,字符串,字符串)';有一些无效的参数
本文关键字:字符串 参数 无效 方法 重载 最佳 | 更新日期: 2023-09-27 18:19:52
我在将值解析到数据集"GetSubmitDataBy"时遇到此错误。我从两个由状态和集群组成的下拉列表和两个包含开始日期和结束日期的文本框中获取值。
protected void Button1_Click(object sender, EventArgs e)
{
RunTimeDSTableAdapters.tbl_runtime_reportTableAdapter state = new RunTimeDSTableAdapters.tbl_runtime_reportTableAdapter();
DataTable dt = new DataTable();
DateTime dt1 = Convert.ToDateTime(TextBox1_CalendarExtender.SelectedDate);
DateTime dt2 = Convert.ToDateTime(TextBox2_CalendarExtender.SelectedDate);
dt1.ToString("MM/DD/YYYY");
dt2.ToString("MM/DD/YYYY");
dt = state.GetSubmitDataBy(DropDownList1.SelectedValue, dt1, dt2, DropDownList2.SelectedValue);
GridView1.DataSource = dt;
GridView1.DataBind();
}
GetSubmitDataBy的签名是:
public virtual RunTimeDS.tbl_runtime_reportDataTable GetSubmitDataBy(string Cluster, string startDate, string endDate, string State) {
this.Adapter.SelectCommand = this.CommandCollection[2];
if ((Cluster == null)) {
this.Adapter.SelectCommand.Parameters[0].Value = global::System.DBNull.Value;
}
else {
this.Adapter.SelectCommand.Parameters[0].Value = ((string)(Cluster));
}
if ((startDate == null)) {
this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
}
else {
this.Adapter.SelectCommand.Parameters[1].Value = ((string)(startDate));
}
if ((endDate == null)) {
this.Adapter.SelectCommand.Parameters[2].Value = global::System.DBNull.Value;
}
else {
this.Adapter.SelectCommand.Parameters[2].Value = ((string)(endDate));
}
if ((State == null)) {
this.Adapter.SelectCommand.Parameters[3].Value = global::System.DBNull.Value;
}
else {
this.Adapter.SelectCommand.Parameters[3].Value = ((string)(State));
}
RunTimeDS.tbl_runtime_reportDataTable dataTable = new RunTimeDS.tbl_runtime_reportDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
}
}
dt1.ToString("MM/DD/YYYY");
dt2.ToString("MM/DD/YYYY");
什么都不做!你必须纠正线路
dt = state.GetSubmitDataBy(DropDownList1.SelectedValue.ToString(), dt1.ToString("MM/DD/YYYY"), dt2.ToString("MM/DD/YYYY"), DropDownList2.SelectedValue.ToString());