dsRoles = DataLayer.ExecuteQuery("as_GetRole", Params, CommandType.StoredProcedure);What was causing the error you were having ?
>>using System; >>using System.Collections.Generic; >>using System.Configuration; >>using System.Data; >>using System.Data.Common; >>using System.Data.SqlClient; >>using Marois.Common.DataAccess; >> >>public partial class crlRoles : System.Web.UI.UserControl >>{ >> private DataSet dsRoles = null; >> private DataAccess DataLayer = null; >> >> protected void Page_Load(object sender, EventArgs e) >> { >> if (!IsPostBack) >> { >> DataLayer = new DataAccess(); >> _LoadList(); >> } >> } >> >> private void _LoadList() >> { >> DataLayer.ProviderInvariantName = "System.Data.SqlClient"; >> DataLayer.ConnectionString = ConfigurationManager.ConnectionStrings["ApexGlobalConnectionString"].ConnectionString; >> >> dsRoles = DataLayer.ExecuteQuery("as_GetRole", CommandType.StoredProcedure); >> >> lstRoles.DataSource = dsRoles.Tables[0]; >> lstRoles.DataTextField = "RoleName"; >> lstRoles.DataBind(); >> } >> >> protected void lstRoles_SelectedIndexChanged(object sender, EventArgs e) >> { >> if (lstRoles.SelectedIndex > -1) >> { >> int RoleKey = (int)dsRoles.Tables[0].Rows[lstRoles.SelectedIndex]["RoleKey"]; >> >> SqlParameter pRoleKey = new SqlParameter("@RoleKey", RoleKey); >> List<DbParameter> Params = new List<DbParameter>(); >> Params.Add(pRoleKey); >> >> dsRoles = DataLayer.ExecuteQuery("as_GetRole", Params, CommandType.StoredProcedure); >> >> txtRoleName.Text = dsRoles.Tables[0].Rows[0]["Name"].ToString(); >> txtRoleCode.Text = dsRoles.Tables[0].Rows[0]["RoleCode"].ToString(); >> txtDescription.Text = dsRoles.Tables[0].Rows[0]["Description"].ToString(); >> } >> } >>} >> >>