Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. string sql = String.Format("select Peer_guid from State where file_md5 = '{0}'", md5);
  2. List<string> guids = new List<string>();
  3.  
  4. try
  5. {
  6. using (SQLiteConnection c = new SQLiteConnection(ConnectionString))
  7. {
  8. c.Open();
  9. using (SQLiteCommand cmd = new SQLiteCommand(sql, c))
  10. {
  11. SQLiteDataReader reader = cmd.ExecuteReader();
  12. while (reader.Read())
  13. {
  14. string guid = (string)reader["Peer_guid"];
  15. guids.Add(guid);
  16. }
  17. reader.Close();
  18. reader.Dispose();
  19. }
  20. }
  21. }
  22. catch (Exception ex)
  23. {
  24. Console.WriteLine("Error ({0}): {1}", ex.Message, ex.StackTrace);
  25. logFile.WriteErrorLog(ex.ToString());
  26. return null;
  27. }
  28.  
  29. return guids;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement