public MainForm() { InitializeComponent(); string cnStr = @"Data Source=(local)\SQLEXPRESS;Initial Catalog=AUTOLOT;Integrated Security=True"; dal = new InventoryDALDisLayer(cnStr); //grid inventoryGrid.DataSource = dal.GetAllInventory(); }
public void DataBind() { string cnStr = ConfigurationManager.ConnectionStrings["InventoryConnectionString"].ConnectionString; string sql = "select * from inventory"; string tableNmae = "inventory"; dal = new InventoryDALDisLayer(cnStr, sql); this.dataGridView1.DataSource = dal.GetAllInventory(tableNmae); }
public MainForm() { InitializeComponent(); string cnStr = @"data source = (localdb)\MSSQLLocalDB;Initial Catalog = AutoLot;Integrated Security = SSPI; Pooling = False"; dal = new InventoryDALDisLayer(cnStr); inventoryGrid.DataSource = dal.GetAllInventory(); }
public MainForm() { InitializeComponent(); string cnStr = @"Data Source=127.0.0.1;Initial Catalog=AutoLot;" + "Integrated Security=True;Pooling=False"; // 创建数据访问对象 dal = new InventoryDALDisLayer(cnStr); // 填充网格 inventoryGrid.DataSource = dal.GetAllInventory(); }
public MainForm() { InitializeComponent(); string cnStr = @"Data Source=(localdb)\v11.0;Initial Catalog=AutoLot;Integrated Security=True;"; // Create our data access object. dal = new InventoryDALDisLayer(cnStr); // Fill up our grid! inventoryGrid.DataSource = dal.GetAllInventory(); }
public MainForm() { InitializeComponent(); // Assume we have an App.config file // storing the connection string. string cnStr = ConfigurationManager.ConnectionStrings["AutoLotSqlProvider"].ConnectionString; // Create our data access object. dal = new InventoryDALDisLayer(cnStr); // Fill up our grid! inventoryGrid.DataSource = dal.GetAllInventory(); }
static void Main(string[] args) { Console.WriteLine("***** LINQ over DataSet *****\n"); // Get a DataTable containing the current Inventory // of the AutoLot database. InventoryDALDisLayer dal = new InventoryDALDisLayer( @"Data Source=(local)\SQLEXPRESS;Initial Catalog=AutoLot;Integrated Security=True"); DataTable data = dal.GetAllInventory(); // Comment / uncomment to test. // PrintAllCarIDs(data); ApplyLinqQuery(data); Console.WriteLine(); BuildDataTableFromQuery(data); Console.ReadLine(); }