我遇到了幾個關於將數據庫/表導出到txt文件的問題/答案。幾乎每個解決方案都使用Java I/O。我想知道是否有人用本地sqlite命令取得了成功。以下是我的代碼,它不起作用。我真的很感激,如果有人有任何想法得到這個工作。將sqlite結果導出到一個文件
String OutputFile=Environment.getExternalStorageDirectory()+"/"+output + ".txt";
databaseHelper.getDatabase().beginTransaction();
databaseHelper.getDatabase().execSQL(".mode list");
databaseHelper.getDatabase().execSQL(".separator |");
databaseHelper.getDatabase().execSQL(".output " + OutputFile);
databaseHelper.getDatabase().execSQL("select * from "+ TABLE_NAME);
databaseHelper.getDatabase().execSQL(".exit");
databaseHelper.getDatabase().endTransaction();
感謝您的回覆。我想在我的Android應用程序中提供將表格內容發送給自己的功能。這就是我想將表格導出到txt文件的原因。 – Indrajeet 2011-04-10 12:51:07