07-28-2013, 10:48 AM
MySqlConnectionStringBuilder mySqlConnectionStringBuilder = new MySqlConnectionStringBuilder();
mySqlConnectionStringBuilder.Server = this.textBox_host.Text;
mySqlConnectionStringBuilder.UserID = this.textBox_user.Text;
mySqlConnectionStringBuilder.Database = this.textBox_db.Text;
mySqlConnectionStringBuilder.Password = this.textBox_password.Text;
MySqlConnection mySqlConnection = new MySqlConnection(mySqlConnectionStringBuilder.ConnectionString);
MySqlConnection mySqlConnection2 = new MySqlConnection(mySqlConnectionStringBuilder.ConnectionString);
mySqlConnection2.Open();
MySqlCommand mySqlCommand = new MySqlCommand();
mySqlCommand.Connection = mySqlConnection;
{
try
{
mySqlConnection.Open();
MySqlCommand MySqlCommand = new MySqlCommand();
MySqlCommand.Connection = mySqlConnection;
string text = this.Shops.SelectedItem.ToString();
MySqlCommand.CommandText = string.Concat(new string[]
{
"select * from `",
textBox_db.Text,
"`.`t_shop` where a_keeper_idx=",
text,
";"
});
this.Reader = MySqlCommand.ExecuteReader();
this.Reader.Read();
this.textBox_name.Text = this.Reader["a_keeper_idx"].ToString();
this.Reader.Dispose();
}
catch (MySqlException ex)
{
MessageBox.Show("Error:\n" + ex.Message);
}
finally
{
if (this.Reader != null)
{
this.Reader.Dispose();
}
if (mySqlConnection != null)
{
mySqlConnection.Close();
mySqlConnection.Dispose();
}
}
}
My Code. I want if i click on this name that this displays on the textBox_name. How i can do that? Hope of help
Regards Jaiz

