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

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Sep 22 19:26:53 CDT 2004


On 9/22/04 6:57 PM, "Aldwin Pollefeyt" <realbasic at datalinesolutions.net>
wrote:

> '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))

Do you give to Valentina the file with first line -- names?
Valentina then will add it as first record.
You need remove this line for Valentina.

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

Correct.

Have you check error here?
Cursor is okay?

>    'import the changed file
>    myCursor.importText(my2ndFolderItem)

Try to import you CONVERTED file sing Valentina Studio for Window
Link on home page.

If it can do this, then file is ok.
Otherwise problem is in file.

>    '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

Aha, here you remove it.



-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list