Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-07-13 : 09:28:25
|
Hanim writes "Sir,I am a VB.NET programmer.I have a table Production(MS ACCES DataBase)having record number having prefix AA. I want to traverse through the database on click of FIRST, NEXT, PREVIOUS, LAST buttons. My query works fine for the FIRST & LAST. But not for PREVIOUS & NEXT. They print in the order AA001,AA010, AA011 ....AA002, AA020.... I want AA002 after AA001 when I click NEXT button.Here are my queries.FIRSTSelect Prd_RecNo, Name From Production where Prd_RecNo in (select min(Prd_RecNo) from production)PREVIOUS Select Prd_RecNo, Name From Production where Prd_RecNo in (select max(Prd_RecNo) from production where Prd_RecNo<'" & sProdCode & "')NEXT Select Prd_RecNo,Name From Production where Prd_RecNo in (select min(Prd_RecNo) from production where Prd_RecNo>'" & sProdCode & "')"LASTSelect Prd_RecNo,Name From Production where Prd_RecNo in (select max(Prd_RecNo) from production)Prd_RecNo is the field of type text in production tablesProdCode is a Variable (VB.NET) which returns the currently displayed record number.Please clarify my doubt. It may be simple to you, But past few days I am smoking my head for this.RegardsHanim" |
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-07-13 : 10:10:06
|
I got the correct results when tested.y don't u use Recordset object (of ADO.Net) and do the operation ?Also, if u use ur way, make sure u do comparisons after "trimming" all variables and data.Srinika |
 |
|
|
|
|
|
|