• 家庭记账本第七次


    package com.example.jizhangben;
    
    import android.content.ContentValues;
    import android.content.Context;
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.database.sqlite.SQLiteOpenHelper;
    
    public class CostDB extends SQLiteOpenHelper {
    
        public static final String TABLE_NAME = "costs";
        public static final String MONEY = "money";
        public static final String DATE = "date";
        public static final String TITLE = "title";
    
        public CostDB(Context context) {
            super(context, "costs1", null, 1);
        }
    
        @Override
        public void onCreate(SQLiteDatabase db) {
            db.execSQL("create table if not exists "+ TABLE_NAME +"("+
                    "id integer primary key, "+
                    "title varchar, "+
                    "date varchar, "+
                    "money varchar)");
        }
        public void insertCost(costBean costBean1)
        {
            SQLiteDatabase database=getWritableDatabase();
            ContentValues cv=new ContentValues();
            cv.put(TITLE,costBean1.costTitle);
            cv.put(DATE,costBean1.costDate);
            cv.put(MONEY,costBean1.costMoney);
            database.insert("TABLE_NAME",null,cv);
        }
        public Cursor getAllCostData(){
            SQLiteDatabase database = getReadableDatabase();
            return database.query("TABLE_NAME",null,null,null,null,null,null);
        }
        public void deleteAllData(){
            SQLiteDatabase database=getWritableDatabase();
            database.delete("TABLE_NAME",null,null);
        }
        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    
        }
    }
  • 相关阅读:
    Flink 架构和拓扑概览
    Flink 如何背压
    流式计算的时间模型
    流式计算的背压问题
    大数据流式计算容错方案演进之路
    Flink 任务提交
    Flink wordCount
    线性回归和逻辑回归的区别
    Nginx反向代理后配置404页面
    Httpclient 实现带参文件上传
  • 原文地址:https://www.cnblogs.com/chaogehahaha/p/14915585.html
Copyright © 2020-2023  润新知