Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a ADO database????

Status
Not open for further replies.

bitshifter05

Programmer
Jul 15, 1999
13
0
0
US
I am starting to work on a database program in which I want to store and save info. from different types of fields. I was reading in a VB6 book about ADO database interface the only trouble with all the examples in that book is that they all used an exsisting database created in Access. I was wondering if there is a way to use the ADO to creat a new database file. and if so how. If you have any info that could help me or even a web site that my have the info that I am looking for.<br>
<br>
Thanks <A HREF="mailto:Bitshifter05@Yahoo.com">Bitshifter05@Yahoo.com</A><br>

 
Not sure if this ADO or not<br>
<br>
CreateDatabase, CreateTableDef, Append Methods Example<br>
<br>
This example creates a new database, Nwindex.mdb. The example attaches three dBASE IV tables from the C:\Program Files\Microsoft Office\Office folder to the database.<br>
<br>
Dim nWindEx As Database, customerTable As TableDef<br>
Dim orderTable As TableDef, employeeTable As TableDef<br>
Dim dataSource As String<br>
dataSource = &quot;dBASE IV;&quot; & _<br>
&quot;DATABASE=C:\Program Files\Microsoft Office\Office&quot;<br>
appPath = Application.DefaultFilePath<br>
Set nWindEx = Workspaces(0) _<br>
.CreateDatabase(Application.DefaultFilePath _<br>
& &quot;\NWINDEX.MDB&quot;, dbLangGeneral)<br>
' add Customer table<br>
Set customerTable = nWindEx.CreateTableDef(&quot;Customer&quot;)<br>
customerTable.Connect = dataSource<br>
customerTable.SourceTableName = &quot;Customer&quot;<br>
nWindEx.TableDefs.Append customerTable<br>
' add Orders table<br>
Set orderTable = nWindEx.CreateTableDef(&quot;Orders&quot;)<br>
orderTable.Connect = dataSource<br>
orderTable.SourceTableName = &quot;Orders&quot;<br>
nWindEx.TableDefs.Append orderTable<br>
' add Employee table<br>
Set employeeTable = nWindEx.CreateTableDef(&quot;Employee&quot;)<br>
employeeTable.Connect = dataSource<br>
employeeTable.SourceTableName = &quot;Employee&quot;<br>
nWindEx.TableDefs.Append employeeTable<br>
MsgBox &quot;The database &quot; & nWindEx.Name & &quot; has been created.&quot;<br>
nWindEx.Close<br>
<br>
<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top