2013-09-28 3 views
1

트라이얼 버전 인 안드로이드 애플리케이션을 개발했습니다 ... 사용자가 제한된 시설을 가지고 있기 때문에 사용자 엔트리를 1로 제한하고 싶습니다. ... 등록 및 디스플레이 내가 그것을 위해 무엇을해야 4로 제한하는 결과 .. 나는 Select Count(column Name) from tbalename를 사용하여SQLite 데이터베이스 엔트리 제한하기

package com.example.loginpage; 

import android.content.Context; 
import android.database.sqlite.SQLiteDatabase; 
import android.database.sqlite.SQLiteDatabase.CursorFactory; 
import android.database.sqlite.SQLiteOpenHelper; 
import android.util.Log; 

public class DataBaseHelper extends SQLiteOpenHelper 

{ 

     public DataBaseHelper(Context context, String name,CursorFactory factory, int version) 
     { 
        super(context, name, factory, version); 


     } 


     // Called when no database exists in disk and the helper class needs 
     // to create a new one. 


     @Override 
     public void onCreate(SQLiteDatabase _db) 
     { 
       _db.execSQL(LoginDataBaseAdapter.DATABASE_CREATE); 

     } 



     // Called when there is a database version mismatch meaning that the version 
     // of the database on disk needs to be upgraded to the current version. 



     @Override 
     public void onUpgrade(SQLiteDatabase _db, int _oldVersion, int _newVersion) 
     { 



       // Log the version upgrade. 


       Log.w("TaskDBAdapter", "Upgrading from version " +_oldVersion + " to " +_newVersion + ", which will destroy all old data"); 

       // Upgrade the existing database to conform to the new version. Multiple 
       // previous versions can be handled by comparing _oldVersion and _newVersion 
       // values. 
       // The simplest case is to drop the old table and create a new one. 


       _db.execSQL("DROP TABLE IF EXISTS " + "TEMPLATE"); 


       // Create a new one. 


       onCreate(_db); 
     } 





} 

답변

0

테이블에서 계산하기 ... 바로 아래의 코드를 제공하고 있고 풋 상태 코드 if(count>=1){ //Message to user}

관련 문제