【问题标题】:RealBasic: execute shell commandsRealBasic:执行shell命令
【发布时间】:2012-04-17 20:04:41
【问题描述】:

我需要使用 Realbasic 将 CSV 文件加载到 sqlite 数据库中。 按照this 教程中的说明执行此操作没有问题。

你能帮我用 RealBasic 做这件事吗?

我正在尝试使用 Shell 类:

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:在Shell中执行期间没有错误消息。但数据不会导入到表中。

如何解决?

谢谢!

【问题讨论】:

    标签: sqlite csv realbasic


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2011-06-15
      • 2013-01-05
      • 2010-09-14
      • 2017-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多