hi all i need some help in mysql things in C# i done the connection part
by this but ineed some help in how to get data from database
i need some code like how to get data from tables and insert in it
so pleas i need some help
i get a code to get data but it make a problem when get names get it like this
the code
Sorry For that because am not too good in Coding i learn every thing i know in it from internet
by this but ineed some help in how to get data from database
PHP Code:
MySqlConnection conn = new MySqlConnection();
conn = new MySqlConnection();
conn.ConnectionString = "server=" + cbServerSelect.Text + ";" + "user id=" + txtUserInput.Text + ";" + "password=" + txtPassInput.Text + ";" + "database=my";
if (cbServerSelect.Text == "" || txtUserInput.Text == "" || txtPassInput.Text == "")
{
MessageBox.Show("All Fields must be entered");
}
else
{
try
{
conn.Open();
MessageBox.Show("Connection Opened Successfully");
conn.Close();
}
catch (Exception ex)
{
MessageBox.Show("Error Connecting to MySQL DB" + "\r\n" + "\r\n" + ex.Message);
}
}
so pleas i need some help
i get a code to get data but it make a problem when get names get it like this
PHP Code:
System.Byte[]
PHP Code:
MySqlDataReader Reader;
MySqlCommand command = conn.CreateCommand();
command.CommandText = "select name from account";
conn.Open();
Reader = command.ExecuteReader();
while (Reader.Read())
{
string thisrow = "";
for (int l = 0; l < Reader.FieldCount; l++)
thisrow += Reader.GetValue(l) + "";
comboBox1.Items.Add(thisrow);
listBox1.Items.Add(thisrow);
}
conn.Close();