08-11-2012, 08:03 PM
Hey Programmers
I have some simple Questions:
As First i made a Player Counter for my Server in C#, it work all Fine but there some Bugs.
The first bug is then i Click on Load it show me the Player and if i again Click on load it Double the Players.. <--- Fixxed
And the Second bug is then i Click on "Load Players" one time, it load how many Players are online but if i click again i become this error:
This causes two bindings of the collection to bind to the same property.
Parameter name: binding <--- Fixxed
And how i can add a Second Column in the Listbox? To show in which Zone the Player are?
The Code for the IDs look so:
string sql = @"SELECT * FROM `t_users` WHERE a_zone_num <>-1 AND a_subnum=1";
MySqlConnection con;
MySqlConnectionStringBuilder csb = new MySqlConnectionStringBuilder();
csb.Server = "";
csb.UserID = "";
csb.Database = "";
csb.Password = "";
con = new MySqlConnection(csb.ConnectionString);
MySqlConnection connection = new MySqlConnection(csb.ConnectionString);
connection.Open();
DataTable datatable = new DataTable();
MySqlCommand insertBann = new MySqlCommand(sql, connection);
int i = insertBann.ExecuteNonQuery();
MySqlDataAdapter dataAdapter = new MySqlDataAdapter(sql, connection);
dataAdapter.Fill(datatable);
MySqlDataReader mdr = null;
mdr = insertBann.ExecuteReader();
while (mdr.Read())
{
sql = mdr["a_idname"].ToString();
// Here Should ad the a_zone_num row ?
listBox1.Items.Add(sql);
}
mdr.Close();
2
// With This Code it work to Show the Zones but not in a new Column:
sql = mdr["a_idname"].ToString();
sql1 = mdr["a_zone_num"].ToString();
listBox1.Items.Add(sql);
listBox1.Items.Add(sql1);
[/Code]
2

