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 

  • 相关阅读:
    02.ZooKeeper的Java客户端使用
    01.ZooKeeper安装和介绍
    02.Elasticsearch入门
    01.Elasticsearch安装
    01.ActiveMQ安装部署
    springboot项目打包时提示“程序包xxx不存在,找不到符号”
    Eclipse提交git代码 报错authentication not supported
    Eclipse提交git代码 报错authentication not supported
    utf8mb4_general_ci报错解决方案
    mysql开启远程访问
  • 原文地址:https://www.cnblogs.com/wpf123/p/2052872.html
Copyright © 2011-2022 走看看