Hi guys, (i am new to c#), the underneath code has been cracking my head for 2 days now, could some help.
When i debug this code, once it gets to the first and second if statements, it will jump to else statements, but the if statement for the boolean works fine (I dont seems to get why). Thanks guys
When i debug this code, once it gets to the first and second if statements, it will jump to else statements, but the if statement for the boolean works fine (I dont seems to get why). Thanks guys
private void DisplayCustomer(string Customer) { ClsSqlServer obj = new ClsSqlServer(); DataSet objdataset = obj.getCustomer(Customer); // Bind the data to UI string strCustomerName = objdataset.Tables[0].Rows[0][0].ToString(); string strCountryName = objdataset.Tables[0].Rows[0][1].ToString(); string strgender = objdataset.Tables[0].Rows[0][2].ToString(); string strHobbies = objdataset.Tables[0].Rows[0][3].ToString(); bool Married = Convert.ToBoolean(objdataset.Tables[0].Rows[0][4]); // if (objdataset.Tables[0].Rows[0][4] != DBNull.Value) //{ // Married = Convert.ToBoolean(objdataset.Tables[0].Rows[0][4]); //} TxtCustomerName.Text = strCustomerName; drpCountry.Text = strCountryName; if ((strgender.Length == 0) || (strgender == "Female")) { radioFemale.Checked = true; } else { radioMale.Checked = true; } if (strHobbies == "Swimming") { chkbSwimming.Checked = true; } else { chkCoding.Checked = true; } if (Married == false) { radioSingle.Checked = true; } else { radioMarried.Checked = true; } }