I am getting an error that an open DataReader associated with this Command, when I'm not using datareader(though probably executereader() is the same thing) how would I close this if I don't have a datareader present?
using (SqlConnection conn = new SqlConnection(ConnectionString))
{
SqlCommand cmd = new SqlCommand("spSelectAllTypes",conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlCommand cmd1 = new SqlCommand("spSelectAllTripA", conn);
cmd1.CommandType = CommandType.StoredProcedure;
conn.Open();
//checkboxlist
cbTransportType.DataSource = cmd.ExecuteReader();
cbTransportType.DataBind();
//dropdownlist
ddlTripTypeA.DataSource = cmd1.ExecuteReader();
ddlTripTypeA.DataTextField = "TripType";
ddlTripTypeA.DataValueField = "TripTypeID";
ddlTripTypeA.DataBind();
}
I just want to be able to databind a bunch of dropdownlist in one open connection. (before I had multiple open and closes for each control)