zoukankan      html  css  js  c++  java
  • 2021.3.5

    搭建数据库,创建DBHelper类,在Java里新建一个class,命名DBHelper

    package com.example.myaccountapp;

    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) {

    }
    }

  • 相关阅读:
    Zepto源码分析-动画(fx fx_method)模块
    CSS3用法理解
    移动端网页meta设置和响应式
    javascript基础-正则表达式
    net core 2.x
    angular
    .net core 2.x
    .net core 2.x
    DDD
    DDD
  • 原文地址:https://www.cnblogs.com/SirNie/p/14911001.html
Copyright © 2011-2022 走看看