| Read Responses | Return to Index | Read Prev Msg | Read Next Msg |

Slink-e / CDJ Discussion Archive #9

Re: Export DB Feature

Posted By: Rich Boykin <boykster@j...>
Date: 9/21/00 1:55pm

In Response To: Re: Export DB Feature (Shaun Armbrust)

Well, this isn't a third party or command line option, but you could always use odbc, ado, and some vbscript to generate an output in any format you'd like (well pretty much any format).

Create an odbc link to the database from the control panel, choose ms access as the driver type. Name it whatever you like (cdj in this case).

Launch notepad, or other text editor....and insert code similar to this....

 '----start of sample code----

dim db, rst, fso, file, strText

'create the objects to manipulate the data

set fso = createobject("scripting.filesystemobject")

set db = createobject("adodb.connection")

set rst = createobject("adodb.recordset")

'create a file to dump the data to

set file = fso.createtextfile("c:\cdj_output.txt", true)

file.writeLine("Title,Artist") ' write a title line for the output table

'open the database connection and grab a simple recordset

db.open "dsn=cdj;uid=;pwd=;" 'change the "cdj" entry to your odbc entry

set rst = db.execute("select title, artist from albums")

'loop through the recordset writing out the data to a text file

with rst


do until .eof

'build a comma delimted list of data fields

strText = rst("title") & "," & rst("artist")




end with

'close the file


'dereference the other objects


set rst=nothing


set db = nothing

set fso = nothing

'----end sample code----

(sorry the code is not formatted...couldn't figure out how to have it formatted properly :/)

Now save this file with a .vbs extension. This script requires two things, that window scripting host is installed (installed by default on many new ms os's, or can be downloaded from ms), and that ado is installed (I believe that cdj installs mdac 2.1 which should include the ado libraries).

when you run this file, you will generate a text file that has a simple comma separated list (csv) of the album titles and artists. With a little bit of tweaking this can easily be altered to generate output data in any format you want. Modify the "select ...." statement to retrieve whatever data you are interested in.



Responses To This Message

| Read Responses | Return to Index | Read Prev Msg | Read Next Msg |


Slink-e / CDJ Discussion Archive #9 is maintained by slinke-bbs-owner@nirvis.com with WebBBS 3.21.