![](/img/trans.png)
[英]How to update using DataSet (C# and MySQL) with the database with no primary key
[英]How to update a cell in dataset using C#
我需要从一个数据集来检查值NOT COMPLETED
的列状态下存在,那么如果是,请更换NOT COMPLETED
与COMPLETED
。 我在C#中使用数据集和数据适配器。 到目前为止,这是我所做的。 非常感谢您的帮助。 先感谢您
public void check()
{
DataRow[] cs;
//search for value of "NOT COMPLETED" in the "case" table in the dataset
cs = ds2.Tables["News"].Select("status = 'NOT COMPLETED'");
}
要获取状态为“ NOT COMPLETED”的所有行,可以查看以下代码:
const string news = "news";
const string status = "status";
const string notCompleted = "'NOT COMPLETED'";
DataSet ds = new DataSet();
ds.Tables.Add(news);
ds.Tables[news].Columns.Add(status);
ds.Tables[news].Rows.Add("test");
ds.Tables[news].Rows.Add(notCompleted);
ds.Tables[news].Rows.Add("dummy");
IEnumerable<DataRow> dataRows = ds.Tables[news].Rows.Cast<DataRow>().Where(row => row[status].ToString() == notCompleted);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.