using System.Data.SqlClient;
public int CustomerID {get;set;}
public string CustomerName {get;set;}
public string ContactName {get;set;}
public string Address {get;set;}
public string City {get;set;}
public string PostalCode {get;set;}
public string Country {get;set;}
public Customer(string customerName, string contactName, string address, string city, string postalCode, string country)
CustomerName = customerName;
ContactName = contactName;
public static void Main()
string sql = "INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode, Country) Values (@CustomerName, @ContactName, @Address, @City, @PostalCode, @Country);";
using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools()))
Customer c = new Customer("Brian Hoskins", "Brian", "12 Jones Place", "New York", "NY12", "US");
var affectedRows = connection.Execute(sql, c);
Console.WriteLine(affectedRows);
var customers = connection.Query<Customer>("Select * FROM CUSTOMERS WHERE CustomerName = 'Brian Hoskins'").ToList();
FiddleHelper.WriteTable(customers);