Guest User

Untitled

a guest
Jan 31st, 2018
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. mysql> select Price from rates order by id;
  2. +-------+
  3. | Price |
  4. +-------+
  5. | 100 |
  6. | 120 |
  7. | 150 |
  8. | 200 |
  9. | 350 |
  10. | 700 |
  11. | 500 |
  12. | 700 |
  13. | 800 |
  14. | 1300 |
  15. | 1500 |
  16. | 7000 |
  17. | 8000 |
  18. | 15000 |
  19. | 20000 |
  20. +-------+
  21. 15 rows in set
  22.  
  23. public List<string[]> ExecuteQuery(string command)
  24. {
  25. com = new MySqlCommand(command, con);
  26. reader = com.ExecuteReader();
  27. if (reader.HasRows)
  28. {
  29. List<string[]> records = new List<string[]>();
  30. while (reader.Read())
  31. {
  32. string[] row = new string[reader.FieldCount];
  33. for (int i = 0; i < reader.RecordsAffected; i++)
  34. row[i] = reader[i].ToString();
  35. records.Add(row);
  36. }
  37. reader.Close();
  38. return records;
  39. }
  40. else
  41. {
  42. reader.Close();
  43. return new List<string[]>();
  44. }
  45. }
  46.  
  47. MySqlCommand com = new MySqlCommand("select Access from useraccounts where Username = '" + tbxUsername.Text + "' and Pass = '" + tbxPassword.Text + ''', d.con);
  48. object result = com.ExecuteScalar();
Add Comment
Please, Sign In to add comment