c#dataview遍历_C# DataView.Find方法代码示例
//引入命名空间
using System;
using System.Data;
using System.Data.SqlClient;
class FindingDataRowViews {
public static void Main() {
SqlConnection mySqlConnection =
new SqlConnection(
"server=localhost;database=Northwind;uid=sa;pwd=sa"
);
SqlCommand mySqlCommand = mySqlConnection.CreateCommand();
mySqlCommand.CommandText =
"SELECT CustomerID, CompanyName, Country " +
"FROM Customers";
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter();
mySqlDataAdapter.SelectCommand = mySqlCommand;
DataSet myDataSet = new DataSet();
mySqlConnection.Open();
mySqlDataAdapter.Fill(myDataSet, "Customers");
mySqlConnection.Close();
DataTable customersDT = myDataSet.Tables["Customers"];
string filterExpression = "Country = 'UK'";
string sortExpression = "CustomerID";
DataViewRowState rowStateFilter = DataViewRowState.OriginalRows;
DataView customersDV = new DataView();
customersDV.Table = customersDT;
customersDV.RowFilter = filterExpression;
customersDV.Sort = sortExpression;
customersDV.RowStateFilter = rowStateFilter;
foreach (DataRowView myDataRowView in customersDV) {
for (int count = 0; count < customersDV.Table.Columns.Count; count++) {
Console.WriteLine(myDataRowView[count]);
}
Console.WriteLine("");
}
int index = customersDV.Find("BSBEV");
Console.WriteLine("BSBEV found at index " + index + "\n");
DataRowView[] customersDRVs = customersDV.FindRows("BSBEV");
foreach (DataRowView myDataRowView in customersDRVs) {
for (int count = 0; count < customersDV.Table.Columns.Count; count++) {
Console.WriteLine(myDataRowView[count]);
}
Console.WriteLine("");
}
}
}
c#dataview遍历_C# DataView.Find方法代码示例相关推荐
- python apache benchmark_Python cudnn.benchmark方法代码示例
本文整理汇总了Python中torch.backends.cudnn.benchmark方法的典型用法代码示例.如果您正苦于以下问题:Python cudnn.benchmark方法的具体用法?Pyt ...
- doc python 颜色_Python wordcloud.ImageColorGenerator方法代码示例
本文整理汇总了Python中wordcloud.ImageColorGenerator方法的典型用法代码示例.如果您正苦于以下问题:Python wordcloud.ImageColorGenerat ...
- java kryo_Kryo框架使用方法代码示例
Kryo框架的source已移至https://github.com/EsotericSoftware/kryo ,进入此页面,然后点击右边的Download Zip按钮,就能下载到最新版本的Kryo ...
- python3 console input_Python console.colorize方法代码示例
本文整理汇总了Python中pygments.console.colorize方法的典型用法代码示例.如果您正苦于以下问题:Python console.colorize方法的具体用法?Python ...
- python dateformatter_Python dates.DateFormatter方法代码示例
本文整理汇总了Python中matplotlib.dates.DateFormatter方法的典型用法代码示例.如果您正苦于以下问题:Python dates.DateFormatter方法的具体用法 ...
- python中的scaler_Python preprocessing.MaxAbsScaler方法代码示例
本文整理汇总了Python中sklearn.preprocessing.MaxAbsScaler方法的典型用法代码示例.如果您正苦于以下问题:Python preprocessing.MaxAbsSc ...
- python paperclip_Python pyplot.sca方法代码示例
本文整理汇总了Python中matplotlib.pyplot.sca方法的典型用法代码示例.如果您正苦于以下问题:Python pyplot.sca方法的具体用法?Python pyplot.sca ...
- python fonttool_Python wx.Font方法代码示例
本文整理汇总了Python中wx.Font方法的典型用法代码示例.如果您正苦于以下问题:Python wx.Font方法的具体用法?Python wx.Font怎么用?Python wx.Font使用 ...
- Java IOUtils.copy方法代码示例(亲测)
本文整理汇总了Java中org.apache.commons.io.IOUtils.copy方法的典型用法代码示例.如果您正苦于以下问题:Java IOUtils.copy方法的具体用法?Java I ...
最新文章
- 11 个好用的科研工具推荐!工作效率提升 max!
- PoE供电中功率损耗问题
- control.add()
- 安全研究人受够!再公布WordPress 3大外挂漏洞
- AttributeError: module ‘tensorflow‘ has no attribute ‘app‘
- win7下安装Oracle10g解决方案
- 纽约时报:安全问题将毁掉整个互联网
- 计网 --- 域名服务系统:因特网的目录服务
- Exchange 2010部署
- string 与stringbuilder的区别
- 51单片机微波炉c语言程序,基于51单片机的微波炉控制C源程序.doc
- 科学研究设计七:单案例设计
- 幼儿园计算机课件制作,幼儿园课件制作工具
- python回复qq_「转」使用python发送qq消息
- linux wep加密方式,iPad wifi 断网问题通过设置加密方式(Mixed WEP)解决
- 设计模式:(中介者模式)
- 第四章:jQuery动画
- SQL Server numeric数据类型
- GMSSL :SM2椭圆曲线公钥密码算法——数字签名算法4
- rr分布 matlab,讲解:E471、Econometric Theory、R、RR|Matlab