//Without Dapper using (MySqlConnection con = new MySqlConnection(conString)) { using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM Bars", con)) { cmd.CommandType = CommandType.Text; using (MySqlDataAdapter sda = new MySqlDataAdapter(cmd)) { using (DataTable dt = new DataTable()) { sda.Fill(dt); dataGridView1.DataSource = dt; } } } }
var sql = "select * from customers"; List<tblbars> lstBars = MySqlHelp.Connection.Query<tblbars>(sql).ToList(); dgvBars.DataSource = lstBars; public class TblBars { public int BarId { get; set; } public int Width { get; set; } public int Thickness { get; set; } public string Type { get; set; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)