Tutorial by Examples

// Uses Windows authentication. Replace the Trusted_Connection parameter with // User Id=...;Password=...; to use SQL Server authentication instead. You may // want to find the appropriate connection string for your server. string connectionString = @"Server=myServer\myInstance;Database=myDa...
public void SaveNewEmployee(Employee newEmployee) { // best practice - wrap all database connections in a using block so they are always closed & disposed even in the event of an Exception // best practice - retrieve the connection string by name from the app.config or web.config (dep...
var providerName = "System.Data.SqlClient"; //Oracle.ManagedDataAccess.Client, IBM.Data.DB2 var connectionString = "{your-connection-string}"; //you will probably get the above two values in the ConnectionStringSettings object from .config file var factory = DbProviderFac...

Page 1 of 1