BaseNow - Database Front-End Software
*
Home Buy Download Details Support
BaseNow Forums 
Home
Login Register Member List
  » BaseNow Forums   » Questions   » Importing Data from Text Files  

Welcome Guest ( Login or Register )

Importing Data from Text Files
Author
Message
Posted 7/18/2005 1:31 PM
Forum Member
Forum Newbie

Group: Forum Members
Active: 7/22/2005
Posts: 4

I have about 3000 text files, each containing data in the following format:

DATE NUMBER NUMBER  NUMBER

The numbers are all integers and each column is seperated by spaces.   I need to import the data from each text file into a database table (ACCESS).  How do I accomplish this using BaseNow?

Also, the text files do not have the "txt" file extension, so BaseNow does not recognize them as text files.  How can I get BaseNow to recognize these files as text files without changing the file extension for each text file to txt?

MM
IP Logged
This member is offline.
Posted 7/19/2005 1:01 AM
Forum Administrator
Forum Administrator

Group: Advanced Members
Active: 5/25/2007
Posts: 63
You do not need to specify the file name. The folder on a hard disk will be presented as a database, and all text files from the folder as tables.

For more information, please visit these web pages:
"How to import data from a text file"
http://www.basenow.com/help/How_to_import_data_from_a_text_file.asp

"Working with text files"
http://www.basenow.com/help/Working_with_text_files.asp

There is a video that shows how to configure the program at this web page:
http://www.basenow.com/help/Import%20from%20text.avi

You will need to install the codec that is available from this location:
http://www.basenow.com/help/Installing_video_codec.htm
IP Logged
This member is offline.
Posted 7/19/2005 12:24 PM
Forum Member
Forum Newbie

Group: Forum Members
Active: 7/22/2005
Posts: 4

If one specifies a folder name, BaseNow does not recognize the files in the folder as text files unless they have the "txt" file extension.  Is there a way of getting BaseNow to recognize all files in the folder as text files even though they do not have the txt file extension?

MM
IP Logged
This member is offline.
Posted 7/20/2005 5:09 AM
Forum Administrator
Forum Administrator

Group: Advanced Members
Active: 5/25/2007
Posts: 63
You can use files that do not have "txt" extensions. The trick is to enter the connection string manually and change the "extensions" parameter. Here is an example:

Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=[FolderName];Extensions=[Extensions];Persist Security Info=False

Replace [FolderName] with the folder location.

Replace [Extensions] with the list of extensions separated by comma. For example: asc,csv,tab,txt

In the Data Link Properties window select the Connection tab. Select the "Use connection string" option and enter the connection string in the textbox below the option.

I hope this helps. Please let me know if there is anything else I can assist you with.
IP Logged
This member is offline.
Posted 7/20/2005 2:45 PM
Forum Member
Forum Newbie

Group: Forum Members
Active: 7/22/2005
Posts: 4

I have entered the connection string manually as you specified, while opening the folder containing the text files as a database, and I can now see the list of text files under CONNECTIONS/DATABASE/TABLES, but when I select one of the file names for viewing, I get an error window titled BoundTable.Connect displaying the following error message: "ODBC Driver does not support the requested properties". When I click on the "+" next to the file name, BaseNow stops responding to the OS and I have to terminate it.

As stated previously, I have about 3000 text files all under the C:\sndata folder.  Some of the files have extensions such as 1, 2, 3, 4, 5, T, etc while some do not have any extensions.  Unfortunately I have another program updating these files on a regular basis, so I cannot change the file extensions to txt.

 

 

MM
IP Logged
This member is offline.
Posted 7/21/2005 1:58 AM
Forum Administrator
Forum Administrator

Group: Advanced Members
Active: 5/25/2007
Posts: 63
The text driver is not able to read your files. It is possible that values in your text files are not formatted properly. Each value should be separated by a text delimiter.

Could you send me a sample file that is created in C:\sndata folder? You can use e-mail address or post the first several lines from the file to this topic.
IP Logged
This member is offline.
Posted 7/21/2005 4:00 PM
Forum Member
Forum Newbie

Group: Forum Members
Active: 7/22/2005
Posts: 4

Data each appears as follows (sample):

20050620   405    395    405    2536314
20050621   404    397    400    1355576
20050622   400    393    396    2555313
20050623   404    390    401    5569497
20050624   405    395    405    2445900
20050627   404    396    400    966678
20050628   397    391    394    537589
20050629   400    391    391    1548488
20050630   394    388    392    1815801

Files do not have a header row, but the values are DATE, LOW, HIGH, CLOSE, TRADED (share price for a particular stock).

Thanks for your help.

MM
IP Logged
This member is offline.
Posted 7/22/2005 6:55 AM
Forum Administrator
Forum Administrator

Group: Advanced Members
Active: 5/25/2007
Posts: 63
It looks like the spaces between column values cannot be recognized by a text driver. The driver is written by Microsoft and it is not an integral part of BaseNow. There is no way I can change BaseNow to allow the program to read those text files.

You can try to create a file called "Schema.ini" and place it in the folder together with the text files. In the ini file, you can specify how the values are delimited. For example:

Tab Delimited - Fields in the file are delimited by tabs.
CSV Delimited - Fields in the file are delimited by commas (comma-separated values).
Custom Delimited - Fields in the file are delimited by any character you choose to input into the dialog box.

-or-

With no delimiter specified.

For more information, please see this web page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcjetschema_ini_file.asp

Let me know if you experience any problems.
IP Logged
This member is offline.
Showing page 1 of 1 - 8 messages found
« Next Oldest :: Next Newest »

Powered by InstantForum.NET v3.4
Copyright © 2002, 2004, InstantASP Ltd. All rights reserved.