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

Slink-e / CDJ Discussion Archive #10

Export DB feature extension

Posted By: Willem Hemelop <dw.hemelop@i...>
Date: 10/15/00 3:19am

Since Colby removed the possibility to save the database as ascii textfile I've been puzzling how to convert the MS Access file or read it in my Delphi program. But without expensive other programs like Access2000 or an ADO license it didn't work. This was until I found in the archives a posting from Rich Boykin about an export DB feature. This feature really works but it was not enough for me so I expanded it to export other fields and tracktitles as well. I know nothing about basic scripts but I do know a bit about programming. By trial and error I found out this code. The export result is a semicolon delimited file. But of course it was Rich Boykin who showed the way to do it. Thanks !!!

Willem Hemelop

'----start of sample code---- dim db, rst, tst, fso, file, strAlbum, strTrack 'create the objects to manipulate the data set fso = createobject("scripting.filesystemobject") set db = createobject("adodb.connection") set rst = createobject("adodb.recordset") set tst = createobject("adodb.recordset") 'create a file to dump the data to set file = fso.createtextfile("c:\cdj_output.txt", true) file.writeLine("Title;Artist;Track;Playing Time;Player;Position;Imagefile") ' write a title line for the output table 'open the database connection and grab a simple recordset db.open "dsn=CDJuser;uid=;pwd=;" 'change the "cdj" entry to your odbc entry set rst = db.execute("select title, artist, tracks, minutes, seconds, player, position, imagefile from albums") set tst = db.execute("select title, minutes, seconds from tracks") 'loop through the recordset writing out the data to a text file with rst .movefirst do until .eof 'build a comma delimted list of data fields strAlbum = rst("title") & ";" & rst("artist") & ";" & rst("tracks") & ";" & rst("minutes") & ":" & rst("seconds") & ";" & rst("player") & ";" & rst("position") & ";" & rst("imagefile") file.writeLine(strAlbum) with tst for t = 1 to rst("tracks") strTrack = tst("title") & ";" & rst("artist") & ";" & t & ";" & tst("minutes") & ":" & tst("seconds") file.writeLine(strTrack) .movenext next end with strTrack = "" .movenext loop end with 'close the file file.close 'dereference the other objects rst.close tst.close set rst=nothing set tst=nothing db.close set db = nothing set fso = nothing '----end sample code----

Responses To This Message

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

Password:

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