protected void ddlSelect_SelectedIndexChanged(object sender, EventArgs e) { DataAccessSQL dbAccess = new DataAccessSQL(); if (ddlSelect.SelectedValue.Trim() == "ALL") { GridAuthor.DataSource = dbAccess.ExecuteSelectCommand("GetAuthors", CommandType.StoredProcedure); } else { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@state", ddlSelect.SelectedValue) }; GridAuthor.DataSource = dbAccess.ExecuteParamerizedSelectCommand("GetAuthorByState", CommandType.StoredProcedure, param); GridAuthor.DataBind(); } }
protected void ddlPublisher_SelectedIndexChanged(object sender, EventArgs e) { if (ddlPublisher.SelectedValue.Trim() == "ALL") { gridTitle.DataSource = daSQL.ExecuteSelectCommand("select * from titles", CommandType.Text); gridTitle.DataBind(); } else { string query = "select * from titles where pub_id = @pubid"; SqlParameter param = new SqlParameter("@pubid", ddlPublisher.SelectedValue); gridTitle.DataSource = daSQL.ExecuteParamerizedSelectCommand(query, CommandType.Text, new SqlParameter[] { param }); gridTitle.DataBind(); } }