Hello,
I'm working in c# asp.net and oracle as database. I am binding 10 records in my Dataset ds order by Created_Date desc.
I wanto skip first record to get bind to Dataset ds. How to do it ?
If possible if I can handle it Proc, it is also fine.
My Proc :
Select * from Table T1 where CoverNote = '123456' order by Created_Date desc;
Thank You in advance !
Sushant TorankarPosted Mar 4, 2025, 3:21 PM
Hello All,
Than you for your wonderful replies, that helped me to fix my issue
Jignesh KumarPosted Mar 4, 2025, 4:23 AM
Hello,
You can achieve this in two ways
Sangeetha SPosted Mar 4, 2025, 4:16 AM
Instead of binding all 10 records and then skipping the first one, you can adjust your SQL query to fetch records starting from the second one. Here’s an example:
Daniel WrightPosted Mar 3, 2025, 4:31 PM
To skip the first record when binding data to a Dataset in ASP.NET, you can make use of the `Skip` method along with LINQ. Assuming you have already fetched the records from your database and stored them in a DataTable within your Dataset `ds`, here's how you can skip the first record:
This code snippet uses LINQ to skip the first record in your DataTable and creates a new DataTable `recordsToBind` that excludes the first row. You can then use this new DataTable for your binding operations.
If you prefer to handle this logic in a stored procedure, you can adjust your SQL query to exclude the first record. One way to achieve this is by using ROW_NUMBER() function in Oracle SQL. Here's an example:
By adding the ROW_NUMBER() in a subquery and filtering where `rn > 1`, you effectively skip the first record in the result set before returning the data to your ASP.NET application.
I hope this explanation helps you achieve the desired outcome in skipping the first record when binding data to your Dataset in ASP.NET. If you have any further questions or need more clarification, feel free to ask!