Hi Guys,
I am creating a new database, with a table and inserting some fields
in it
But I get the following error in opening or creating database.
What am I missing ?
Thanks a lot
>>> ERROR/Database(167): sqlite3_open_v2("data2", &handle, 6, NULL) failed
code follows......
public class DataBaseWork extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ArrayList<String> results = new ArrayList<String>();
SQLiteDatabase myDB = null;
String MY_DATABASE_TABLE = "t_Users";
try {
/* Create the Database (no Errors if it already exists) */
myDB.openOrCreateDatabase("data2", null);
myDB.execSQL("CREATE TABLE IF NOT EXISTS "
+ MY_DATABASE_TABLE
+ " (LastName VARCHAR, FirstName VARCHAR,"
+ " Country VARCHAR, Age INT(3));");
myDB.execSQL("INSERT INTO "
+ MY_DATABASE_TABLE
+ " (LastName, FirstName, Country, Age)"
+ " VALUES ('Ggggggg', 'Nnnnnn', 'Geeeeeeee',
20);");
} catch (SQLException e){
}
if (myDB != null)
myDB.close();
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---