public List<SoapComment> GetComments(string deviceId) { List<SoapComment> comments = new List<SoapComment>(); MySqlConnection con = DB.getNewConnection(); con.Open(); string sql = "SELECT * FROM comments WHERE mobile_device_id = " + deviceId; MySqlCommand cmd = new MySqlCommand(sql, con); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { SoapComment comment = new SoapComment(); comment.Nickname = (string)reader["nickname"]; comment.Pros = (string)reader["pros"]; comment.Cons = (string)reader["cons"]; comments.Add(comment); } reader.Close(); con.Close(); return comments; }
public List <SoapComment> GetComments(string deviceId) { List <SoapComment> comments = new List <SoapComment>(); MySqlConnection con = DB.getNewConnection(); con.Open(); string sql = "SELECT * FROM comments WHERE mobile_device_id = " + deviceId; MySqlCommand cmd = new MySqlCommand(sql, con); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { SoapComment comment = new SoapComment(); comment.Nickname = (string)reader["nickname"]; comment.Pros = (string)reader["pros"]; comment.Cons = (string)reader["cons"]; comments.Add(comment); } reader.Close(); con.Close(); return(comments); }