Advertisement
Guest User

Untitled

a guest
May 20th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. public ActionResult ConnectionTest()
  2.         {
  3.             List<String> shopping_carts = new List<string>();// change data type to model (not yet created)
  4.  
  5.             string sql = " SELECT * FROM shopping_cart ";
  6.             var connectionConfig = new DB.MySqlConfig();
  7.             MySqlConnection con = new MySqlConnection(connectionConfig.getConfig());
  8.  
  9.             var cmd = new MySqlCommand(sql, con);
  10.  
  11.             con.Open();
  12.  
  13.             MySqlDataReader reader = cmd.ExecuteReader();
  14.  
  15.             while (reader.Read())
  16.             {
  17.                 shopping_carts.Add(Convert.ToString(reader["total_price"]));
  18.             }
  19.  
  20.             return View();
  21.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement