4
Answers

database related question

Photo of umair mohsin

umair mohsin

9y
747
1
hello to everyone
 
i want to design an application in which i want to fetch data from database.there would be text boxes as per database columns and 4 buttons
for first,last,next and previous record.  i want to show data base data in these text boxes and loop through each database record using. i think now the scenerio is very clear.anybody help me in it

Answers (4)

0
Photo of Akash Varshney
NA 788 791.2k 9y

As per my understanding you need two show database values to your UI . in your case those are text boxes .

Now suppose you have a table which have some columns like below.

DB table

Id

Col1

Col2

Col3

Col4

1

111

222

333

444

2

Aaa

 

Ccc

Ddd

3

Xxx

Yyy

Zzz

Ooo

         
      
 

UI text box

txtbox1             111

Txtbox2             222

Txtbox3            333

Txtbox4            444

<<First < prv nxt> last>>

you want to see data in the textboxes on click of those buttons

  • OFFSET excludes the first set of records.
  • OFFSET can only be used with an ORDER BY clause.
  • OFFSET with FETCH NEXT returns a defined window of records.
  • OFFSET with FETCH NEXT is great for building pagination support.

FIRST CLICK----- Select * from Table Offset 0 Fetch Next 1 Row

Last click-------- Select * from Table Offset (n-1) Fetch Next 1 Row

in the same way you NEED KNOW maintain the OFFSET Value to get the Specific result

0
Photo of Priyaranjan K S
NA 35.4k 8.5m 9y
Hi,
 
You may check out this for more info :
http://www.functionx.com/vcsharp2003/databases/Lesson02.htm
 
Thanks,
Priyan
 
If you found this useful Please mark this as Answer 
0
Photo of umair mohsin
969 405 74.6k 9y
no akash i really don't understand what you are saying can you please elaborate your answer by giving an example application
 
0
Photo of Akash Varshney
NA 788 791.2k 9y
you dont need any other coloumns. you only should have a coloumn which will be having it the primaryId .
When you fetch the record you should know how many records are avaiable and what is the page size .. I think in your case page size is one.
Check more in SQL About FETCH, OFFSET .. You will get your answer with more clarity!! Hope i may answerd your question .