zoukankan      html  css  js  c++  java
  • wpf dataGrid 简单数据绑定

    数据实体类:
    [Table(Name = "customers")]
        public class Customer
        {
     
            private string _CustomerID;
            [Column(IsPrimaryKey=true,Storage="_CustomerID")]
            public string CustomerID
            {
                get
                {
                    return this._CustomerID;www.wpf123.com
                }
                set
                {
                    this._CustomerID = value;
                }
            }
     
            private string _City;
            [Column(Storage = "_City")]
            public string City
            {
                get
                {
                    return this._City;
                }
                set
                {
                    this._City = value;
                }
            }
     
            private string _CompanyName;
            [Column(Storage = "_CompanyName")]
            public string CompanyName
            {
                get
                {
                    return this._CompanyName;
                }
                set
                {
                    this._CompanyName = value;
                }
            }

    dataGrid数据绑定:
    System.Data.Linq.DataContext db = new DataContext("Data Source=.;Initial Catalog=northwind;Integrated Security=True");
                Table<Customer> customers = db.GetTable<Customer>();
     
                IQueryable<Customer> custQuery =
                    from cust in customers
                    where cust.City == "London"
                    select cust;
                dataGrid1.ItemsSource = custQuery.ToList();

    http://www.wpf123.com/news/?185.html 

  • 相关阅读:
    coolSQL安装与使用
    测试经验--测试流程总结
    测试经验--测试用例结构设计
    python 爬虫与数据可视化--数据提取与存储
    python 爬虫与数据可视化--爬虫基础知识
    在Eclipse中用TODO标签管理任务(Task)
    Web性能优化:图片优化
    Firebug入门指南
    Git远程操作详解
    Firebug控制台详解
  • 原文地址:https://www.cnblogs.com/wpf123/p/2052872.html
Copyright © 2011-2022 走看看