*突然查询开始显示没有这样的表,但直到昨天它工作正常。卡在这段代码上。请帮忙 *
点击时
公共无效 onClick(查看 arg0){
String stckCenterid=String.valueOf(headerDb.getStockCenterId(dat1));
String stockItemId=String.valueOf(headerDb.getStockItemId(stckCenterid));
System.out.println("StockCenterid, Stockitemid " + stckCenterid +" "+ stockItemId);
headerDb.getStockLedger(stckCenterid,stockItemId,from_date_format,to_date_format);
}
});
这个股票中心 id 是根据需要来的,但我将相同的传递给 getstockitemid 但查询显示的不是这样的表,即下面的查询。我将这些中心 ID 和项目 ID 传递给另一个查询以获取结果
询问
public int getStockItemId(String stCenterId) {
db = this.getReadableDatabase();
Cursor c = db.rawQuery("SELECT STOCK_ITEM_ID from qt_um_stock_items_qty WHERE " +
" STOCK_CENTRE_ID " + " = ? " , new String[] { stCenterId });
c.moveToFirst();
int index = c.getColumnIndex("STOCK_ITEM_ID");
return c.getInt(index);
}
日志猫
> 10-22 09:06:46.449: W/dalvikvm(1050): threadid=1: thread exiting with
> uncaught exception (group=0x40a71930) 10-22 09:06:46.509:
> E/AndroidRuntime(1050): FATAL EXCEPTION: main 10-22 09:06:46.509:
> E/AndroidRuntime(1050): android.database.sqlite.SQLiteException: no
> such table: qt_um_stock_items_qty (code 1): , while compiling: Select
> STOCK_ITEM_ID from qt_um_stock_items_qty WHERE STOCK_CENTER_ID=? 10-22
> 09:06:46.509: E/AndroidRuntime(1050): at
> android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native
> Method) 10-22 09:06:46.509: E/AndroidRuntime(1050): at
> android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882)
> 10-22 09:06:46.509: E/AndroidRuntime(1050): at
> android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493)
> 10-22 09:06:46.509: E/AndroidRuntime(1050): at
> android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
> 10-22 09:06:46.509: E/AndroidRuntime(1050): at
> android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
> 10-22 09:06:46.509: E/AndroidRuntime(1050): at
> android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37) 10-22
> 09:06:46.509: E/AndroidRuntime(1050): at
> android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
> 10-22 09:06:46.509: E/AndroidRuntime(1050): at
> android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
> 10-22 09:06:46.509: E/AndroidRuntime(1050): at
> android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1253)
> 10-22 09:06:46.509: E/AndroidRuntime(1050): at
> com.manacle.umma.activity.HeaderDb.getItemId(HeaderDb.java:3864) 10-22
> 09:06:46.509: E/AndroidRuntime(1050): at
> com.manacle.umma.activity.StockBalrep$4.onClick(StockBalrep.java:187)
> 10-22 09:06:46.509: E/AndroidRuntime(1050): at
> android.view.View.performClick(View.java:4204) 10-22 09:06:46.509:
> E/AndroidRuntime(1050): at
> android.view.View$PerformClick.run(View.java:17355) 10-22
> 09:06:46.509: E/AndroidRuntime(1050): at
> android.os.Handler.handleCallback(Handler.java:725) 10-22
> 09:06:46.509: E/AndroidRuntime(1050): at
> android.os.Handler.dispatchMessage(Handler.java:92) 10-22
> 09:06:46.509: E/AndroidRuntime(1050): at
> android.os.Looper.loop(Looper.java:137) 10-22 09:06:46.509:
> E/AndroidRuntime(1050): at
> android.app.ActivityThread.main(ActivityThread.java:5041) 10-22
> 09:06:46.509: E/AndroidRuntime(1050): at
> java.lang.reflect.Method.invokeNative(Native Method) 10-22
> 09:06:46.509: E/AndroidRuntime(1050): at
> java.lang.reflect.Method.invoke(Method.java:511) 10-22 09:06:46.509:
> E/AndroidRuntime(1050): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
> 10-22 09:06:46.509: E/AndroidRuntime(1050): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 10-22
> 09:06:46.509: E/AndroidRuntime(1050): at
> dalvik.system.NativeStart.main(Native Method) 10-22 09:06:49.110:
> I/Process(1050): Sending signal. PID: 1050 SIG: 9 10-22 09:06:50.629:
> E/Trace(1330): error opening trace file: No such file or directory (2)
> 10-22 09:06:51.482: D/dalvikvm(1330): GC_FOR_ALLOC freed 130K, 10%
> free 2504K/2780K, paused 64ms, total 72ms 10-22 09:06:51.969:
> I/Choreographer(1330): Skipped 63 frames! The application may be
> doing too much work on its main thread. 10-22 09:06:52.050:
> D/gralloc_goldfish(1330): Emulator without GPU emulation detected.
> 10-22 09:06:52.699: I/Choreographer(1330): Skipped 85 frames! The
> application may be doing too much work on its main thread.