Hello,
I am working asp.net and oracle as db.
I am searching data with PolicyNo, but pollicy has multiple rows(For ex.15 rows) depending on Covers.When i am binding that policy to dataset ds, it binds 15 rows.
I dont want to get same policy no again, coz I am looping Dataset ds in FOR loop. DISTINCT is not working
| PolicyNo | RefNo | Cover | Cover_Premium |
| 123 | 888 | cover1 | 100 |
| 123 | 888 | cover2 | 200 |
| 123 | 888 | cover3 | 300 |
| 123 | 888 | cover4 | 400 |
Once the policy is saved, I dont want to get the same policy no again.
Thanks in advance

William Gram25 reputationPosted Jul 2, 2025, 9:08 PM EDT
SELECT DISTINCT FROM YourTable
Sangeetha SRank #212 · 11.4K reputationPosted Jul 4, 2025, 6:39 AM EDT
This is a common and efficient approach in C#:
HashSet processedPolicies = new HashSet(); foreach (DataRow row in ds.Tables[0].Rows) { string policyNo = row["PolicyNo"].ToString(); if (!processedPolicies.Contains(policyNo)) { // Process this policy // Your logic here... processedPolicies.Add(policyNo); // Mark as processed } }