2.21 账本开发2

Posted on 2021-02-21 14:22  ***Pepsi***  阅读(19)  评论(0编辑  收藏  举报

DBHelper

package com.example.zhangbengapp;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class DBHelper extends SQLiteOpenHelper {

    private static int DB_VERSION = 1;
    private static String DB_NAME = "account_daily.db";

    public DBHelper(Context context) {
        super(context, DB_NAME ,null, DB_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql="create table account(_id integer primary key autoincrement," +//主键
                "Title varchar(20)," +//Title
                "Date varchar(20)," +//Date
                "Money vaechar(20))";//Money
        db.execSQL(sql);
    }
    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}

 

Copyright © 2024 ***Pepsi***
Powered by .NET 8.0 on Kubernetes