|
|
Yesterday I have discussed a database management system using a database file created in Microsoft Access. Today I will show you how to create a simple database system without using the MS Access file, you simply create a text file that can be updated from your program. To create a text file, you can use the following command Open "fileName" For Output As #fileNumber Each text file created must have a file name and a file number for identification. As for the file name, you must also specify the path where the file will reside. For example: Open "c:\My Documents\sample.txt" For Output As #1 will create a text file by the name of sample.txt in the My Document folder. The accompanying file number is 1. If you wish to create and save the file in drive A, simply change the path, as follows" Open "A:\sample.txt" For Output As #1 If you wish to create a HTML file, simple change the extension to .html Open "c:\My Documents\sample.html" For Output As # 2
To read a file , you can use the input # statement. The syntax is shown below: Open "fileName" For Input As #1 You have to open the file according to its file number and the variable that holds the data. You also need to declare the variable using the DIM command.
*More examples will be shown tommorrow. |