Hi
I tried to filter record according to the selected value, now its giving me a weird error that i hav never seen sayn "An unhandled exception of type 'System.StackOverflowException' occurred in ClsLibUserman.dll" this error points to this code below
public int RightID
{
get { return RightID; }
set { RightID = value; }
}
Below is my class
public ClsUsers(string firstName, string surname,int rID, string uID, string mail, string rName, string description)
{
fName = firstName;
sName = surname;
email = mail;
rightID = rID;
userID = uID;
rightName = rName;
desc = description;
}
public string FName
{
get { return fName; }
set { fName = value; }
}
public string SName
{
get { return sName; }
set { sName = value; }
}
public int RightID
{
get { return RightID; }
set { RightID = value; }
}
public string UserID
{
get { return userID; }
set { userID = value; }
}
public string Email
{
get { return email; }
set { email = value; }
}
public string RightName
{
get { return rightName; }
set { rightName = value; }
}
public string Desc
{
get { return desc; }
set { desc = value; }
}
public string Password
{
get { return password; }
set { password = value; }
}
public string Username
{
get { return username; }
set { username = value; }
}
Below is the code from my business layer
#region GetSpecificUser()
public ClsUsers GetSpecificUser(string UserID)
{
using (SqlConnection conn = new SqlConnection(ConnString))
{
SqlCommand cmd = new SqlCommand("procGetUserAndTheirRights", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@userID", SqlDbType.NVarChar));
cmd.Parameters["@userID"].Value = UserID;
ClsUsers users;
try
{
conn.Open();
SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow);
reader.Read();
users = new ClsUsers(Convert.ToString(reader["FName"]), Convert.ToString(reader["LName"]), Convert.ToInt32(reader["RightID"]), Convert.ToString(reader["UserID"]), Convert.ToString(reader["Email"]), Convert.ToString(reader["RightName"]), Convert.ToString(reader["Descriptions"]));
reader.Close();
}
catch (SqlException)
{
throw new ApplicationException("Error reading Shipper info for shipper " + UserID + ".");
}
return users;
}
}
#endregion
Below is my code form mainwindow.xaml.cs
private void cboID_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
users = bl.GetSpecificUser((string)cboID.SelectedValue);
txtname.Text = users.FName;
txtSurname.Text = users.SName;
txtViewEmail.Text = users.Email;
txtViewRightsName.Text = users.RightName;
txtViewDescription.Text = users.Desc;
int var = users.RightID;
txtRightID.Text = var.ToString();
}
The error occured after adding RightID from my stored procedure