Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have created table on SQL server with field 1. DIR(11 digit number), 2.DIR Version (2 digit number following the DIR) 3. status(status of DIR) and 4.Entry datetime (auto update).
I am trying to create a searchform, search value would be DIR(11 digit number)and trying to get the DIR and version.

Here 11 digit DIR number would be repeated in DB
E.g

DIR number | version | Status | Creation Date
10000000001 | 01 | Started |05.01.2016 10:10
10000000001 | 01 | In process|06.01.2016 10.10
10000000001 | 01 | Completed |07.01.2016 10:10

I want to search only latest entry based on DIR number.

TextBox1(Search value) = DIR number
TextBox2(Result Value) = DIR number
TextBox3(Result Value) = Version.
TextBox3(Result Value) = Status.

Can anybody help me on this?
Posted
Updated 10-Jan-16 19:21pm
v2

1 solution

you can use sql statement to get details by top 1 and order by
SQL
select top 1 dirnumber,version,status from TableName where dirnumber =@dirnumber order by creationdate desc

set the DIR number parameter from user input
 
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