Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have used this code to get the number of rows in another dataset.

C#
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);
                    }
                }


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.
Posted

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?
 
Share this answer
 
Comments
VJ Reddy 13-May-12 12:19pm    
Relevant points to check. 5!
Wendelius 14-May-12 0:18am    
Thanks
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[^].
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900