LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 612 users online 221668 members 826 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Memberlist | Dictionary | News | FAQ
Member Spotlight
Play4Keepz
I have sworn upon the altar of God, eternal hostility...
Mood: Relaxed
You have 1 new message.
Emergency Help
Until you sign up you can't do much. Yes, it's free.

Sign Up Now
Membername:
Password:
Already have an account?
Invite Friends
Active Members
Groups
Contests
Moderators
5 online / 27 MPM
Fresh Topics
  LiveWire / Technical Forums / Programming & Application Development / Viewing Topic

Database in Visual Basic
Replies: 4Last Post June 18 3:23am by Rhapsody
Welcome to LiveWire!
We're Stronger Together.
Join the Community
Single page for this topic Email Print Favorite
( Rhapsody )


Per Ardua Ad Astra

Patron
Tech Support Leader
Reply
I am required to write a program for my end of year project and right now I am at somewhat of a writers block. I have this idea but I just can't seem to be able to put together the code for it or I am too lazy to attempt it. It is the final part of my project and once I have finished it, then my program will be considered finished.

The General idea is that when I select a supplier from the list using the combo box located in the top left hand corner, a search is performed and the boxes underneath are filled with the information from the database. But they should only be filled in this case with items and only 8 items at a time will need to be filled.

So i need to program it in a way where it will stop after the first 8 and when the NEXT BATCH button is pressed the next 8 items from that supplier are filled in, clearing the previous set.

-------
I think, therefore we have nothing in common

There is only one guarantee in life, and that is NOW.


5:56 pm on June 17, 2009 | Joined: Oct. 2005 | Days Active: 1,110
Join to learn more about Rhapsody Barbados | Male | Posts: 13,463 | Points: 33,657
LiveWire Humor
Mods1Blow2Me3Daily

Dairy Product Addict
Reply
are you using j-creator?

-------
"tonight were just actors and this is a sitcom so tell me
you love me and tell me ill get some." - Gorilla Zoe

5:57 pm on June 17, 2009 | Joined: June 2009 | Days Active: 26
Join to learn more about Mods1Blow2Me3Daily Texas, United States | Lesbian Male | Posts: 2,116 | Points: 1,014
( Rhapsody )


Per Ardua Ad Astra

Patron
Tech Support Leader
Reply
Quote: from Mods1Blow2Me3Daily at 8:57 pm on June 17, 2009

are you using j-creator?

Lemme see, Topic Title: Database in Visual Basic, so taking a wild guess based on the topic title, I'll just assume that I am using Visual Basic. And I did not mention anything about it being a java program either.

-------
I think, therefore we have nothing in common

There is only one guarantee in life, and that is NOW.


5:59 pm on June 17, 2009 | Joined: Oct. 2005 | Days Active: 1,110
Join to learn more about Rhapsody Barbados | Male | Posts: 13,463 | Points: 33,657
JamesBrauman


Connoisseur
Reply
Okay. Think about it this way - each 'batch' is a different page. So have a variable to hold the page number, you'll want to initally set it to zero. Each time the 'next batch' button is pressed you'll want to increase this number.

I'm not sure how you are accessing the database, but by having this variable it is easy to get each 'batch'. What you need is to be able to select which item numbers you want to get out of your database. Normally (with SQL for example), you tell the database the record to start at, and the record to end at, and it selects all the records between those two (including the start and end.)

Now you know you only want 8 items per page. So the difference between each start and end number needs to be 8.
So if you're 'starting number' was 0, and your 'end number' was 8, it would select records 0-8.

So you'll need two more variables, lowerLimit and upperLimit. Whenever the next batch button is pressed, you need to:
- Increase the 'batchNumber' by one.
- Make 'lowerLimit' equal to batchNumber * 8.
- Make 'upperLimit' equal to (batchNumber + 1) * 8.

Then you can just do something like this (this is SQL):
SELECT * FROM your_table LIMIT lowerLimit, upperLimit.


Edit: Similarly, for previous batch, all you need to do is recude 'batchNumber' by one, and then evaluate lowerLimit and upperLimit again.

I hope this has helped.

Post edited at 6:08 pm on June 17, 2009 by JamesBrauman


6:05 pm on June 17, 2009 | Joined: Nov. 2005 | Days Active: 202
Join to learn more about JamesBrauman Australia | Straight Male | Posts: 5,770 | Points: 7,652
( Rhapsody )


Per Ardua Ad Astra

Patron
Tech Support Leader
Reply
For anyone interested, I took the lazy way out. I just used the Data Control and the Data grid along with a combo box and a SQL statement and achieved the goal.

-------
I think, therefore we have nothing in common

There is only one guarantee in life, and that is NOW.

3:23 am on June 18, 2009 | Joined: Oct. 2005 | Days Active: 1,110
Join to learn more about Rhapsody Barbados | Male | Posts: 13,463 | Points: 33,657
Single page for this topic Email Print Favorite

Quick Reply

You are signed in as our guest.

Looking for something else?
 

  LiveWire / Technical Forums / Programming & Application Development / Viewing Topic