Home > Mobile > For loop in the update/insert sqlite database error
For loop in the update/insert sqlite database error
Time:10-09
In a for loop to perform database update/insert, database code below C=
Cursor dbhelper. GetReadableDatabase (.) rawQuery ( "Select * from ReadCount where domain=?" , new String [] {model. GetDomain ()}); Be sad etCount chtistina georgina rossetti.british poetess int count=(); Arthur c. lose (); ContentValues CV=new ContentValues (); CV. Put (" domain ", the model getDomain ()); CV. Put (" time ", the model getTime ()); CV. Put (" rulecount, "model. GetRulecount ()); If (count & gt; 0 { The String where="domain=?" ; String [] whereValues={model. GetDomain ()}; Dbhelper. GetWritableDatabase (), update (" ReadCount ", CV, the where, whereValues); } else { Dbhelper. GetWritableDatabase (), insert (" ReadCount ", null, CV); }
By the collapse of baidu statistical background statistics will see a lot of android. Database. Sqlite. SQLiteReadOnlyDatabaseException: attempt to write a readonly database sqlite code (1032), (OS error - 2: No to the file or directory) error led to the collapse of but has not had this problem in my mobile phone, this kind of situation?