Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello,
I want to filter the record from Record_1 To Record_100 or whatever the range we want but without primary key or without using any column name.
I'm using odata C#.
Is it possible and how?

Thanks

What I have tried:

I have tried but with primary key and i want without primary key.
what is the way to filter the range without primary key.
or it is possible?
Posted
Updated 1-Oct-19 20:59pm

Quote:
I want to filter the record ... without primary key or without using any column name.


You do realize that that request is just nonsense, don't you?
You have a set of values in a table that you which to filter down to: in your case "Record_1" to "Record_100" which means that you have to discard all rows which contain data not in that change.
But all data in a table is stored in columns (regardless of any primary key or indeed any other indexing you may have applied).
So you cannot logically do any filtering unless you access the column based data - which means naming the columns that contain the data that differentiates the rows.

What you are asking for is "I want a list of all red cars in the car park, but you must do it blindfolded".

I think you need to go back to your intention and rethink it somewhat - at the moment teh request makes no sense whatsoever.

And while you are at it ... If "Record_n" is a set of values in your DB, then your design is flawed and will give you difficulty. When numbers are stored as part of strings, all comparisons are string based: which means the first different character pair determines the result of the whole comparison. So the order to string based numbers is not 1, 2, 3 ... it's 1, 10, 100, 101, ...109, 11, 110, ...
Don't store numbers as part of strings if you ever want to access and use them as numeric values: it's a PITA.
 
Share this answer
 
Comments
[no name] 2-Oct-19 2:23am    
Okay
But If i want to filter record from specific range so thats is only one way to use primary key or any other column name.
phil.o 2-Oct-19 2:54am    
Filtering means providing criteria ; you cannot provide any criterium without relating to an actual column, or group of columns.
If i understand you well, you're talking about data pagination... Check this out: Paging with ASP.NET Web API OData – Youssef M's Blog[^]
 
Share this answer
 

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