C#代码SQL Server中的错误 [英] Error in C# code SQL server
本文介绍了C#代码SQL Server中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已使用此代码获取另一个数据集中的行数.
I have used this code to get the number of rows in another dataset.
DS_product temp = new DS_product();
foreach (DS_product.ProductsRow product in dS_product1.Tables[0].Rows)
{
if (product[1].ToString() == txt_barcode.ToString())
{
temp.Tables[0].ImportRow(product);
}
}
但是当我使用此代码获取行数时,我仍然没有.
如果(temp.Tables [0] .Rows.Count == 0)
它始终显示为0.
But when i use this code to get the number of rows i still get none.
if (temp.Tables[0].Rows.Count == 0)
It always says 0.
推荐答案
您是否调试了应用程序?几件事要检查
-dS_product1.Tables [0] .Rows
的值是多少? -如果存在行,条件product [1] .ToString()== txt_barcode.ToString()是否为真?
Have you debugged the application? Few things to check
- What is the value of dS_product1.Tables[0].Rows
- If there are rows, is the condition product[1].ToString() == txt_barcode.ToString() ever true?
DataSet对象是表的容器.
要在数据集之间复制数据,请使用复制 [表 [
DataSet object is the container for tables.
To copy the data between datasets use Copy[^] method or re-write data for each table in Tables[^].
这篇关于C#代码SQL Server中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文