Hye guys, below is my code, i dont know why i cant get the actual result into txtTest.text, in debug mode, i did see the result that i want in list[1], without convert to string there will be an error saying that i need to do conversion, after do the conversion, the result is different. please help asap. thx
Code:
{
string myConnection = "datasource=localhost;database=erp;port=3306;username=root;password=123456";
MySqlConnection myConn = new MySqlConnection(myConnection);
try
{
myConn.Open();
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
List<string>[] list = new List<string>[12];
list[0] = new List<string>();
list[1] = new List<string>();
list[2] = new List<string>();
list[3] = new List<string>();
list[4] = new List<string>();
list[5] = new List<string>();
MySqlCommand cmd = new MySqlCommand("SELECT * FROM erp_customer WHERE customer_name = ('" + username_txt.Text + "')", myConn);
cmd.ExecuteNonQuery();
//add
while (dataReader.Read())
{
list[0].Add(dataReader["customer_id"] + "");
list[1].Add(dataReader["customer_name"] + "");
list[2].Add(dataReader["customer_telno"] + "");
list[3].Add(dataReader["customer_address"] + "");
list[4].Add(dataReader["customer_company"] + "");
list[5].Add(dataReader["customer_title"] + "");
}
txtTest.text = convert.toString(List[1]); //<-------Here's the problem
//close Data Reader
dataReader.Close();
//end
}
catch (MySqlException ex)
{
MessageBox.Show("Can't connect to database\n" + ex.ToString());
}
finally
{
//MessageBox.Show("added success", "success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
//myConn.Close();
}
}
}
}
}
}