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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Query

Author  Topic 

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2009-03-22 : 00:08:09
I need a generic query which should be able results.

Ex:

customer

CustomerId name
---------- ----
1 Sam
2 John
3 Rob
4 Max
9 dave
6 nick

If i queried the below records.

3 Rob
4 Max
9 dave

I should able to show in the front end VB.net window.
First should be 3, rob
if i hit next button i should able to produce the 4, max on the screen
if i hit next it should display 9,dave.

If i hit previous with 9,dave on the screen it should go back to previous record 4,Max.

Please provide me a generic scripts which should increment the record or decrement the records.

Thanks for your help in advance !!









bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-03-22 : 00:14:56
how will u get the records 3,4 and after 9 id record
or
will u pass any customerid then u should display the name of the customer
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-03-22 : 00:18:11
declare @var varchar(32)
select @var ='3,4,9'

select * from Table where ','+@var+',' LIKE '%,'+cast(CustomerId as varchar(32))+',%'
Go to Top of Page

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2009-03-22 : 00:37:01
3,4 9 will retrieved based on the selection of the records in the datagrid.

Let me tell what i am trying to do and my requirement.

1)I have created a datagrid on a window which has to pull up all the records exists in the table customer like customer id ,name..


2)All the records which is displayed in the grid is associated with a checked box which a user will select the specific records in the grid for edit or display.
Ex:If the grid displays 10 records he will select 3 records for edit

3)Once he selects the records in the random order which he wants to modify.I need to display that a record in the new window which the user has ability to correct that particular record.

4)After correcting the record user may go to next record or previous which he wants to corrected.

I need to write a generic scripts which should be able to navigate through the records based on the selected records.

Please let me know if i not clear..
Go to Top of Page
   

- Advertisement -