Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 限制SQLite数据库条目_Android_Database_Sqlite - Fatal编程技术网

Android 限制SQLite数据库条目

Android 限制SQLite数据库条目,android,database,sqlite,Android,Database,Sqlite,我开发了一个Android应用程序,它是一个试用版,用户只有有限的设备。。所以我想将用户输入限制为1。。。只有一个用户名可以注册。。结果显示必须限制为4,我必须为此做些什么。。我在下面给出代码 package com.example.loginpage; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatab

我开发了一个Android应用程序,它是一个试用版,用户只有有限的设备。。所以我想将用户输入限制为1。。。只有一个用户名可以注册。。结果显示必须限制为4,我必须为此做些什么。。我在下面给出代码

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);
        }





}

使用Select count COLUMN Name from tbalename和代码ifcount>=1{//Message to user}中的put条件从表中获取计数