正在开发一个Android应用程序,我在其中创建了" Server"数据库。在那个数据库中我有两个表i,e employee_table和attendance_table,因为我没有包含我的onReceive函数和onReceive函数我需要解析新消息,并且消息内容应该存储在employee表和考勤表中所以请我出来解决这个问题..
提前致谢..
这是我的DbHelper.java:
package com.example.attendancesystem;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DbHelper extends SQLiteOpenHelper {
static String DATABASE_NAME="Server";
public static final String EmployeeTable="employee_table";
public static final String Name="name";
public static final String Mobile_no="mobile";
public static final String Id="id";
public static final String AttendanceTable="attendance_table";
public static final String Latitude="Lat";
public static final String Longitude="Lan";
public static final String Accuracy="Accry";
public static final String Date="date";
public static final String Time="time";
public DbHelper(Context context) {
super(context, DATABASE_NAME, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_TABLE="CREATE TABLE "+EmployeeTable+" ("+Id+" INTEGER PRIMARY KEY, "+Name+" TEXT, "+Mobile_no+" VARCHAR(13))";
db.execSQL(CREATE_TABLE);
CREATE_TABLE="CREATE TABLE "+AttendanceTable+" ("+Latitude+" double precision, "+Longitude+" double precision, "+Accuracy+" double,"+Date+" date,"+Time+"time)";
db.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS "+EmployeeTable);
db.execSQL("DROP TABLE IF EXISTS "+AttendanceTable);
onCreate(db);
}
}