Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / A little help here

Author
Message
comando 300
21
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 5th Dec 2003 23:12
How I can do a database when the user put a ammount of data, that data keep save if he quit the program?
Tasik
21
Years of Service
User Offline
Joined: 17th Nov 2003
Location: Canada
Posted: 6th Dec 2003 00:35 Edited at: 6th Dec 2003 00:43
Well I think I might know how to help you.

You Make a file by using
Open To Write 1, "FileName"

Once open you can start saving varibles to that file by using this
Write Byte 1, Varible
(If you are saving really big numbers you would put Write Long 1, Varible or Write Word 1, Varible)

The number "1" is the file number that you opened/created and the "Varible" is the well varible you would like to save.
In its place you would put the varible you wanted to save
Example:
Write Byte 1, Budget or Write Byte 1, Amount

After you have the varible written to the file you then would close the file by using Close File 1

Now you will be able to see a file with the FileName you picked in the folder with your program although it doesn't load the varible back into the code it only saves it.

You load it by Open TO Read 1, "FileName" and Read Byte 1, Varible I think if you write your varible as a byte you have to read it was a byte, and same goes for word or long

Remember always close a file when its not needed
Umm I dono if I helped much because IM bad at explaining things but if you send me the code Im pretty sure I can help and I wouldn't be trying to steal ideas or nothing

There will always be some one a little bit faster, a little bit smarter, a little bit stronger, that some one is me =)
comando 300
21
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 6th Dec 2003 02:05
I want to save the balance of my money so I have to put Write byte 1,balance?
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 6th Dec 2003 20:33
if the variable(called 'balance')holds the amount that your balance is then yes, you would.


GO TO THE ETERNAL DESTINY FORUMS!!! http://forums.eternaldestinyonline.com
Do it now!!!
comando 300
21
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 6th Dec 2003 20:51
the part I don't know understand very well was Open To Write 1, "FileName". I have to put that to can put write byte 1,variable? Then I write close file 1?
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 6th Dec 2003 21:23
Just incase you arn't aware here are the ranges of the various data types from the dbpro help file
home > principles > data types and variables.

Quote: "
INTEGER Range : –2,147,483,648 to 2,147,483,647
REAL Range : 3.4E +/- 38 (7 digits)
BOOLEAN Range : 0 to 1
BYTE Range : 0 to 255
WORD Range : 0 to 65535
DWORD Range : 0 to 4,294,967,295
DOUBLE INTEGER Range : –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
DOUBLE FLOAT Range : 1.7E +/- 308 (15 digits)
"


So if you balence is every going to be less than 0 or greater than 255 don't use save byte, use write long insted.

dbpro : p166mmx @ 233 : 256mb : sb 128pci : sis onboard
comando 300
21
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 6th Dec 2003 22:04
I have to do that of the ranges? but I don't have DBPro, I have DB
comando 300
21
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 7th Dec 2003 00:10
I have to put it in a Do...Loop?

Login to post a reply

Server time is: 2024-11-25 19:29:42
Your offset time is: 2024-11-25 19:29:42