Guest User

Untitled

a guest
Dec 4th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. //C#
  2. string connStr = "server=localhost;user=zafer;database=isee;port=3306;password=ygzp5q;";
  3.  
  4. void ProcessUpdate()
  5. {
  6. using(MySqlConnection conn = new MySqlConnection(connStr))
  7. {
  8. conn.Open();
  9. string query = "SELECT `t`.`TeamName`, `t`.`money`, `s`.`Score` FROM `Teams` `t` LEFT join `SiteScoring` `s` on `s`.`TeamID` =`t`.`TeamID` WHERE `t`.`classID`='1' ORDER BY `t`.`TeamName` ASC";
  10. using(MySqlCommand cmd = new MySqlCommand(query, conn))
  11. {
  12. using(MySqlDataReader reader = cmd.ExecuteReader())
  13. {
  14. int counter = 1;
  15. while(reader.Read())
  16. {
  17. int score = 0;
  18. int money = 0;
  19.  
  20. if(!reader.IsDBNull(1))
  21. money = reader.GetInt32(1);
  22. if(!reader.IsDBNull(2))
  23. score = reader.GetInt32(2);
  24.  
  25. llMessageLinked(LINK_SET, counter, money.ToString(), score.ToString());
  26. counter ++;
  27. }
  28. }
  29. }
  30. }
  31. }
  32.  
  33. public void default_event_state_entry()
  34. {
  35. llSetTimerEvent(30.0);
  36. }
  37.  
  38. public void default_event_timer()
  39. {
  40. ProcessUpdate();
  41. }
  42.  
  43. public void default_event_touch_start(LSL_Types.LSLInteger z)
  44. {
  45. ProcessUpdate();
  46. }
Add Comment
Please, Sign In to add comment