1

I need to load a CSV file into an sqlite DB using Realbasic. There is no problem doing this as described in this tutorial.

Can you help me to do this with RealBasic.

I am trying to use the Shell class:

Dim folder As FolderItem = GetFolderItem("")

Dim sh As Shell = new Shell
sh.Mode = 2

If Not sh.IsRunning Then
  sh.Execute "sh"   
End If

sh.Write( "cd " + folder.ShellPath )  
sh.Write( "sqlite3 " + App.GetDatabaseName() + ".sqlite" )  
sh.Write( ".separator "",""")

sh.Write( ".import " + FileName + " " + TableName )

PS: there are no error messages during execution, in Shell. But the data does not get imported into the table.

How to fix it?

Thanks!

4

1 回答 1

1

尝试使用 WriteLine 而不是 Write 来发送您的命令。

sh.WriteLine( "cd " + folder.ShellPath )  
sh.WriteLine( "sqlite3 " + App.GetDatabaseName() + ".sqlite" )  
sh.WriteLine( ".separator "",""")

sh.WriteLine( ".import " + FileName + " " + TableName )
于 2012-04-19T21:38:18.233 回答