C#代码SQL Server中的错误

编程入门 行业动态 更新时间:2024-10-28 16:16:29
本文介绍了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中的错误

本文发布于:2023-11-07 22:16:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1567583.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   代码   SQL   Server

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!