Solved

Convert .dat database into .mdb

Posted on 1998-10-12
10
8,757 Views
Last Modified: 2013-12-25
Hi,
In VB5, how can i access any database(.dat), read every record, then convert it to Recordset, & save as (.mdb) database ?

NB: The (.dat) database & its fields are specified by the user in run-time, thus, how can i use VB5 to detect the dbase fields, & subsequently create them in (.mdb) ?

Looking forward to ur reply,
Collin
0
Comment
Question by:collinng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 5

Expert Comment

by:chewhoung
ID: 1496858
What database is (.dat) file?
0
 

Author Comment

by:collinng
ID: 1496859
(.dat) which i encounter is a SCALA4.0 databases. Assume it is a normal databases (eg. .dbf, or .txt), is it possible to detect/capture the fields & widths of a database in VB5.0 ?

Cheers,
Collin
0
 
LVL 3

Expert Comment

by:vmano
ID: 1496860
there is a MSDN article which shows how to convert a ASCII text file in to Access Database from scratch. the URL is :
http://support.microsoft.com/support/kb/articles/q103/8/07.asp

let me know if this helps,
vmano
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:collinng
ID: 1496861
Hi, i would appreciate it if someone could give me another web-site address with answers to my question. i don't subscribe MSDN :)

Collin
0
 

Author Comment

by:collinng
ID: 1496862
vmano,
sorry i managed to get in & read the article from the web-site u give. Thanks!.
Do u know whether VB5.0 can read binary file in RecordSet ? Or i need to open it using Seq & Random access method for Binary .dat file ??

cheers,
Collin
0
 
LVL 1

Expert Comment

by:sirigere
ID: 1496863
.dat file is a SQL server datbase database file is it?
0
 
LVL 9

Expert Comment

by:cymbolic
ID: 1496864
What system or program makes the .dat file you wish to read?

Its easy to read files using binary file i/o in vb:
buf$=space$(50)  'input record buffer for record len=50
open "MyFile" for binary as #1
while not eof(1)
 get #1,,buf$
 'do something with the stuff here, like
  'make an insert statement "Insert into tblnam(fld1,fld2..)
   'values("+fld1+","+fld2...)
  'and use .execute on the connection object to insert data
wend
close #1

Or you can create a type structure to read the records into and break down into fields via the type udf.
0
 
LVL 1

Expert Comment

by:sdbanks
ID: 1496865
I see two parts to your question.  The first is that you need to be able to read the .Dat File; and the second is being able to import the field information to an mdb file.  Reading through the comments I get the feeling that more information is needed about your database source.  I did a search on the web for SCALA and found a Business Administration Systems.  This system has a statistics module that allows you to export information so that it can be used in spreadsheets and so on.  Is this what you are doing?


0
 

Author Comment

by:collinng
ID: 1496866
sdbanks, & all,

your rephrasing of my question is Right. Thanks.
(i)to read the .dat Scala data file, my recent soln is to use Scala's provided odbc driver (pervasive odbc) and access a .dat in a network drive. (Qn) However, is there a way to read the .dat file in my local harddisk c:\ ??

(FYI, true enough i can export a statistics module to xls, but i/we are now trying to read/export other modules like general-ledger, sales-ledger, and all rest, inorder to consolidate with same modules in other geographic location.Scala does not provide export of other modules, although it can read/display them.)
 
(ii) to export to mdb database from .dat
tentatively, i would use MS Access(mdb) to link to Scala .dat files, using (pervasive) odbc drivers, and VBasic will open Access(mdb) and access them.
Is it advisible to use DAO recordset in VBasic to access Scala .dat files, using odbc ? without going through MS Access ?


Cheers,
Collin
0
 
LVL 1

Accepted Solution

by:
sdbanks earned 150 total points
ID: 1496867
Sounds to me like you already know exactly what to do:

1.  Create a ODBC connection to the Databases files as provided by the company.
2.  Create an msAccess that would link to the tables in the database.
3.  Create another msaccess database which will contain the fields you require.
4.  Write your program so that it reads the information from the source table and puts it into the destination table.  I would make the source table open a snapshot so it is read-only...Better performance and less chance of writing to wrong table.

Steven
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows Script Host failed (Access is denied.) error 6 339
Access query that references subform 5 48
Copy a row 12 70
Protecting vb6 & .Net code Obfuscation 18 184
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question