本文介绍了错误23方法'EndExecuteNonQuery'没有重载需要0个参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
protected void Page_Load(对象发件人,EventArgs e)
{
}
受保护 void btnshowreng_Click( object sender,EventArgs e)
{
ConnectionManager cm = new ConnectionManager();
cm.Command.CommandText = select * from tblFeedsItems其中InsertDate在' + JQDatePickerstart之间.Date + 'and' + JQDatePickerend.Date + ';
cm.Command.CommandType = CommandType.Text;
cm.Connection.Open();
SqlDataReader dr = cm.Command.ExecuteReader();
DataTable dt = new DataTable( dt 跨度>);
dt.Load(dr);
GridView1.DataSource = dt;
GridView1.DataBind();
cm.Connection.Close();
}
protected void btndelete_Click( object sender,EventArgs e)
{
ConnectionManager cm = new ConnectionManager();
cm.Command.Parameters.Clear();
cm.Command.CommandText = Mysp_tblFeedsItems_delete_byDate;
cm.Command.CommandType = CommandType.StoredProcedure;
cm.Command.Parameters.Add( @ start,SqlDbType.DateTime)。 Value = JQDatePickerstart.Date;
cm.Command.Parameters.Add( @ end,SqlDbType.DateTime)。 Value = JQDatePickerend.Date;
cm.Connection.Open();
cm.Command.EndExecuteNonQuery();
cm.Connection.Close();
}
___________________________________________________
错误符合:cm.Command.EndExecuteNonQuery();
为什么?????????
解决方案
protected void Page_Load(object sender, EventArgs e) { } protected void btnshowreng_Click(object sender, EventArgs e) { ConnectionManager cm = new ConnectionManager(); cm.Command.CommandText = "select * from tblFeedsItems where InsertDate between '" + JQDatePickerstart.Date + "' and '" + JQDatePickerend.Date + "' "; cm.Command.CommandType = CommandType.Text; cm.Connection.Open(); SqlDataReader dr=cm.Command.ExecuteReader(); DataTable dt = new DataTable("dt"); dt.Load(dr); GridView1.DataSource = dt; GridView1.DataBind(); cm.Connection.Close(); } protected void btndelete_Click(object sender, EventArgs e) { ConnectionManager cm=new ConnectionManager(); cm.Command.Parameters.Clear(); cm.Command.CommandText = "Mysp_tblFeedsItems_delete_byDate"; cm.Command.CommandType = CommandType.StoredProcedure; cm.Command.Parameters.Add("@start", SqlDbType.DateTime).Value = JQDatePickerstart.Date; cm.Command.Parameters.Add("@end", SqlDbType.DateTime).Value = JQDatePickerend.Date; cm.Connection.Open(); cm.Command.EndExecuteNonQuery(); cm.Connection.Close(); }
___________________________________________________
the error is in line : cm.Command.EndExecuteNonQuery();
why ?????????
解决方案
这篇关于错误23方法'EndExecuteNonQuery'没有重载需要0个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!