views:

437

answers:

3

Hello,

This code

db = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\Neuer Ordner\baywotch.db5"
TextExportFile = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\Neuer Ordner\Exp.txt"

Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")

cn.Open _
   "Provider = Microsoft.Jet.OLEDB.4.0; " & _
   "Data Source =" & db

strSQL = "SELECT * FROM tblAuction1"

rs.Open strSQL, cn, 3, 3

Set fs = CreateObject("Scripting.FileSystemObject")

Set f = fs.CreateTextFile(TextExportFile, True, True)

a = rs.GetString

f.WriteLine a

f.Close

generates a tab delimited file, however it is not suitable for importing into mysql. I would like it to generate a file similar to a file produced by an access macro, which can be seen here:

http://www.yousendit.com/download/TTZtWmdsT01kMnVGa1E9PQ

The file produced by the vbscript is here:

http://www.yousendit.com/download/TTZtWmdsT00wVWtLSkE9PQ

I would also like to know why the file sizes differ by 50k or so.

edit: The result from the vbscript file uses newline characters that are not recognized by notepad, so the above looks substantially messier when viewed. The macro does not seem to be exporting the html code, which explains why it is a smaller file, however the vbscript doesnot appear to be tab delimited, as it will not import into mysql.

edit: the files look ok under a linux system, so it could be something to do with windows handling..however it is still not correct.

A: 

Both files contain what looks like tab-delimited data as well as HTML code (generated by some MS Office app, by the looks of it). Does tblAuction1 store any OLE Objects? Perhaps when you're exporting those objects it's exporting the file contents?

Patrick Cuff
the html code is retrieved from ebay auction websites by another program. there are no ole obnjects as far as i know. at least on my windows xp system, and according to vbscript, the vbscript generated file is not tab delimited in the same way the access one is.
Joshxtothe4
Do you know anything else it could be?
Joshxtothe4
You could run into issues of the HTML text has tabs embedded in it; the import program will interpret this as the start of a new field.
Patrick Cuff
+1  A: 

It looks like an encoding issue to me. I see that you are passing the Unicode parameter when you create the text file, but there is clearly an encoding difference between the two files.

EBGreen
Is that definitely the problem? The access macro exports as unicode as well..so it should not be a problem..
Joshxtothe4
Well I can't say that it is definitely *the* problem, but when I look at the files they are definitely *not* encoded the same.
EBGreen
+1  A: 
Tester101
Is this a better approach then importing after exporting to a text file?
Joshxtothe4
If it works why not? Why move the data twice when you can move it once, middlemen always increase cost and delay delivery.
Tester101
I second tester101.myopenid.com. Fewer moving parts is (mostly) always good.
Patrick Cuff