Click here to Skip to main content
16,007,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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 ?????????
Posted

EndExecuteNonQuery[^] must be used with BeginExecutenoneQuery[^] in pair. You must pass the return value of BeginExecuteNoneQuery to EndExecuteNoneQuery to let the second know of which query do you talking about...
 
Share this answer
 
change
C#
cm.Command.EndExecuteNonQuery();

to
C#
cm.Command.ExecuteNonQuery();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900