SQLite database handling with android application
Hi i am going to create a SQLite database
and insert records. but my database does not create.
following is the code. Cant understand why. trying this for a long time
If someone can help its a great help
public class DatabaseHelper extends SQLiteOpenHelper{
static final String dbName="MyDatabase";
public DatabaseHelper(Context context) {
super(context, dbName, null,33);
}
@Override
public void onCreate(SQLiteDatabase db) {
String qry = "CREATE TABLE DEPT(dept开发者_高级运维_id INTEGER PRIMARY KEY, deptName TEXT)";
db.execSQL(qry);
}
}
I am calling the constructor like this
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
DatabaseHelper dp = new DatabaseHelper(this);
Toast.makeText(this, "Finish Execution", Toast.LENGTH_LONG).show();
}
}
create your database by using this sample http://marakana.com/forums/android/examples/55.html
精彩评论