C# WPF ListView 数据库
来源:互联网 发布:淘宝如何优化宝贝标题 编辑:程序博客网 时间:2024/05/16 01:18
~~~xmal中的代码~~~只贴ListView控件代码~~~
<ListView Name="listView" Grid.Row="1" Grid.ColumnSpan="2" Margin="20,50" SelectionChanged="listView_SelectionChanged" > <ListView.View> <GridView> <GridViewColumn Header="姓名" DisplayMemberBinding="{Binding Path=CusName}" Width="40"/> <GridViewColumn Header="地址" DisplayMemberBinding="{Binding Path=CusArea}" Width="130"/> <GridViewColumn Header="电话" DisplayMemberBinding="{Binding Path=CusTel}" Width="118"/> </GridView> </ListView.View> </ListView>~~~新建类Customer.cs代码~~~
class Customer { public string CusName { get; set; } public string CusArea { get; set; } public string CusTel { get; set; } }~~~.xmal.cs代码~~~
private void btnOk_Click(object sender, RoutedEventArgs e) { DataTable table = SqlHelper.ExecuteDataTable("select * from T_Test where CusName=@CustName",new SqlParameter("@CustName",txtName.Text)); List<Customer> ltCus=new List<Customer> (); foreach (DataRow dataRow in table.Rows) { Customer cus = new Customer(); cus.CusName=(string)dataRow["CusName"]; cus.CusArea=(string)dataRow["CusArea"]; cus.CusTel=(string)dataRow["CusTel"]; ltCus.Add(cus); } listView.ItemsSource = ltCus; }
数据库的一些~~~引用啊~~~SqlHelper.cs啊~~~App.config配置啊~~~神马的就不出来浪费大家时间了
来张效果图...
- C# WPF ListView 数据库
- C# WPF ListView 数据库
- C# WPF ListView控件应用
- c# WPF listview显示空白条目
- WPF ListView
- C# listview 显示数据库值
- C#进阶WPF基础三 WPF数据绑定、数据库基础
- wpf C# 数据库 c/s 个人信息管理 wpf局域网通信
- WPF 用c#代码实现listview添加控件ProgressBar
- C#读取数据库表数据输入listview
- C#读取数据库表数据输入listview
- C# listView遍历数据库中的图片
- c# wpf
- C# WPF 快速开发06ADO.NET连接数据库
- C# WPF 快速开发07ADO.NET操作数据库
- C# WPF 快速开发09数据库封装类SqlHelper
- C# WPF 快速开发11导入txt数据到数据库
- C# WPF 快速开发12批量数据插入数据库
- 数据库
- ASP.NET MVC中Filter使用
- TCP协议疑难问题讲解
- 数据库三范式
- ios 应用评分
- C# WPF ListView 数据库
- 快递查询从方卡迁移到爱查快递的API
- android - Fragment getView() 总是返回null
- android 之 百度地图
- 使用rlwrap实现SQLplus翻页功能
- 视频码率,帧率和分辨率及H264介绍
- Navigation Drawer介绍
- hdu 1008 Elevator
- Mongodb的备份与恢复