LCKB
[C#] User Counter and settings File - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Programmers Gateway (https://lckb.dev/forum/forumdisplay.php?fid=196)
+---- Forum: Coders Talk (https://lckb.dev/forum/forumdisplay.php?fid=192)
+---- Thread: [C#] User Counter and settings File (/showthread.php?tid=1007)



- Nikolee - 08-11-2012


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




- HateMe - 08-12-2012


thats simple

 

public void MakeListbox(string sql, string sql1)
{
string item = "Player Name: " + sql + " Online Zone: " + sql1;
listBox1.Items.Add(item);

}

 

but u could bether use a datagrid for that




- LadySovereign - 08-18-2012

??????????? ??? ???? ? ???????. ? ? ??? ? ????????, ???? ??? ?????? ?????? ? ????????. ?????????? ????? ?????? ??????? ??? ??????? ?? ???????? ? ???????? ????? 2, ?????? ?? ???????????? ?????? ?? ? ?? ????? ??????. ? ???