-I have a function called getData() There is a select case which determines what SQL statement to use to load the records. Then it fills a tmpTable with the query results. Then it clones the tmpTable to tblAuthors.
-when my form loads it gets the Default case from the getData() .it loads the top 10 records from a sql server database
-then under the frmMain_KeyDown function when I press the up key, It then goes back into the getData() and selects the UpKey case, which is to select the top 1 record.
- The same thing for the Downkey except it gets the DownKey case from the getData()
-Once I press either the down or up key then my datagrid goes from showing 10 records to only displaying one.
- What I want for it to do is, always display 10 records but when I press the up or down key, I would like for it to scroll to the previous record or then next record but still displaying 10 records...(Not just 1).
- Any Help would be greatly appreciated!! Feel free to email me if you have any questions or comments. Thanks in Advance!!
Assuming that you have the first ten fows of your database loaded this should work.
When you press the down key you are going to want to queury the top 11 entries in decending order. Then you are going to need to copy the first entry of the query return and add it to your datatable. At this point you will remove the first row of your data table. With that done you should have entries 2-11 instead of 1-10. To do the next set could add a counter that adds 1 when you press the down key then you would query the top 10+n entiries in decending order take the first one add it to the table then delete to first row of the table.
To it exactly the opsite when you press the up key.
But then again I could have been confused in what you where asking.
Your right, I have the first ten rows loaded in the database. What you are saying sounds like what I want to do, but I'm not sure of the code to get it to do that! If you could help me with the code at all that would be awesome. Right now when I press the downkey it is only selecting the top 1 record from sql which I know is why it's only displaying one record, but I'm not sure of the coding to do what you just said. Thanks for the help so far. Hope to hear from you soon.
You will need to greate an sql database with a database called Other and a table called Table1 with two rows (pKey & Data). I added some data like (1, One 2, Two etc). pKey was a int value with the primary Key and data was just text.
Jeremy
Last edited by Jeremy Martin; Jan 5th, 2003 at 12:25 AM.