Valentina : VCursor.importText problem on Win/ works on mac

Aldwin Pollefeyt realbasic at datalinesolutions.net
Wed Sep 22 17:57:49 CDT 2004


Ok,

What do I do wrong???

----------------------------

'amount of files to import
   j=ubound(importFiles)    'importfiles(-1) as string

'converting each file seperatly
   for i=0 to j

     'clean the table     'SQLTables(-1) as string / PPDB as VDatabase
     testSQL=app.PPDB.SQlExecute("DELETE FROM "+SQLTables(i))

     'copy the file changing the EndOfLines
     myFolderItem=targetFolder.child(importFiles(i))
     my2ndFolderItem=targetFolder.child(importFiles(i)+".bak")
     if my2ndFolderItem<>nil then
       my2ndFolderItem.Delete
     end if
     myTextInput = myFolderItem.OpenAsTextFile
     myTextInput.Encoding=Encodings.WindowsLatin1
     myTextOutput=my2ndFolderItem.CreateTextFile
     myTextOutput.write 
replaceAll(myTextInput.ReadAll,EndOfLine.Windows,EndOfLine.Macintosh)
     myTextOutput.Close
     myTextInput.Close

     'Get the first line of the file to know the tablenames
     myTextInput=my2ndFolderItem.OpenAsTextFile
     myTextInput.Encoding=Encodings.MacRomanLatin1
     firstFromFile=myTextInput.readline
     firstFromFile=replaceall(firstFromFile,chr(9),chr(44))

     'Setting the cursor
     myCursor=nil
     myCursor=app.PPDB.SQlSelect("SELECT "+firstFromFile+" FROM 
"+SQLTables(i),kv_Server,kv_readWrite,kv_Random)

     'Informing the user of the program
     stImportText.Text="Converting :"+SQLTables(i)
     me.refresh

     'import the changed file
     myCursor.importText(my2ndFolderItem)

     'Delete the first line because the tablenames are putted in there
     testSQL=app.PPDB.SQLExecute("DELETE FROM "+SQLTables(i)+" WHERE 
RecId='1'")
     app.PPDB.Flush

   next  ' CVS file

   'indexing the files
   stImportText.Text="Database Indexeren"
   me.refresh
   testSQL=app.PPDB.SQLExecute("REINDEX DATABASE")

----------------------------
Greetings,

Aldwin

Started with RB on the 7th of June 2004



More information about the Valentina mailing list