Hi,

i put the code inside the try catch block and the error is bcoz of
tables(there may be other errors too but first i hav to remove this error)
now my question is where exactly is the database files, where they get
stored...? in workspace or system32 folder or where...? bcoz i couldnt find
the files anywhere, and how can i completely delete all the tables, so that
i can create the database from the start

regards
Bharath BG

On Tue, Sep 1, 2009 at 6:01 PM, leonardo. <[email protected]>wrote:

> You can put a
> try {
> db.execSQL("create table myTable (id integer primary key, name text not
> null);");
> } catch(Exception e) {}
>
> to try to see the error??
>
> 2009/9/1 Bharath B.G. <[email protected]>
>
> Hi, I am very new to SQLite, i referred some books regarding coding in
>> SQLite n went straight for coding
>>
>> But while i run my simple code i am getting error "the application has
>> stopped unexpectadly" (particularly in the line create table)
>>
>> please tell me where exactly is the error n where i hav to modify the code
>>
>>
>>
>> package com.android;
>>
>> import android.app.Activity;
>> import android.content.Context;
>> import android.database.Cursor;
>> import android.database.sqlite.SQLiteDatabase;
>> import android.os.Bundle;
>> import android.widget.EditText;
>>
>> public class DatabaseWork extends Activity {
>>
>> private EditText et;
>>
>> public void onCreate(Bundle icicle) {
>> super.onCreate(icicle);
>>
>> setContentView(R.layout.main);
>> et=(EditText)findViewById(R.id.EditText01);
>>
>> tryThis();
>> }
>>
>> public void tryThis()
>> {
>> final String DATABASE_NAME="myDatabse.db";
>> final String DATABASE_TABLE="myTable";
>> final int DATABASE_VERSION=1;
>>
>> final String COL_NAME="name";
>> final String COL_ID="id";
>>
>> SQLiteDatabase db;
>>
>> db=openOrCreateDatabase(DATABASE_NAME, 0, null);
>> db.execSQL("create table myTable (id integer primary key, name text not
>> null);");
>>
>> db.execSQL("insert into myTable values (1, \"Bharath\");");
>> db.execSQL("insert into myTable values (2, \"Abhijith\");");
>>
>> Cursor c=db.query(DATABASE_TABLE, new String[] { COL_ID,COL_NAME}, null,
>> null, null, null, null);
>>
>> int idCol=c.getColumnIndex(COL_ID);
>> int nameCol=c.getColumnIndex(COL_NAME);
>>
>> String s=null;
>>
>> while(true)
>> {
>> String name=c.getString(nameCol);
>> s=s+" "+name;
>> if(c.isLast())
>> {
>> break;
>> }
>> c.moveToNext();
>> }
>>
>> et.setText(s);
>>
>> db.close();
>> }
>> }
>>
>>
>> --
>> Bharath B.G.
>>
>>
>>
>
>
> --
> Leonardo Ribeiro
> Desenvolvedor Java - iFactory Solutions
> SCJP 1.5
>
>
>
> >
>


-- 
Bharath B.G.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to