本文介绍了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中的错误
发布评论