0

私は Android アプリケーションで作業しており、アプリケーションで sqllite を使用しています。case ステートメントを含むクエリで SQL を更新したいと考えています。このクエリを実行するための正しい解決策を提案し、int 値を返してテーブルが正常に更新されたかどうかを確認してください。

私のクエリ::

UPDATE TblAgencies SET Selected= CASE WHEN ID=6 THEN 1 ELSE 0 END
4

3 に答える 3

-1
 try
            {
                database=openOrCreateDatabase("solutiondb", MODE_PRIVATE, null);
                database.execSQL("update patientdetails set name='"+naMe+"',dob='"+DOB+"',gender='"+genDer+"',height="+heiGht+",weight="+weiGht+",bmi="+BMI+",bloodgroup='"+bloodGroup+"',profession='"+proFession+"',address='"+addRess+"',contact="+contactNumber+",smoking='"+smoKing+"',drinking='"+drinKing+"',maritalstatus='"+maritalStatus+"',physician='"+phySican+"' where id="+patientId+"");
                Toast.makeText(PersonalInformationActivity.this, "Your Personal Details Are Saved Successfully", Toast.LENGTH_LONG).show();
                dialog.dismiss();
                intent=new Intent(PersonalInformationActivity.this, PersoxcsdActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(intent);
                database.close();
            }
            catch(SQLException exception)
            {

            }   
于 2013-11-11T12:34:47.887 に答える