[android-developers] Re: XML files and SQLITE Database
On Sep 14, 8:49 am, Bishan tvbis...@gmail.com wrote: i have a xml file.(pls see attachement). and i need insert data in my xml file to a sqlite database in my android project. hw can i do this ? Client.xml 18KViewDownload See http://groups.google.com/group/android-developers/browse_thread/thread/dec5475bcd98ea15/af98b5805d28e709#af98b5805d28e709 Skip the step about TextView and read something how to use sqlite in android app pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: XML files and SQLITE Database
thanx skink. i'll try this. :) On Wed, Sep 14, 2011 at 12:33 PM, skink psk...@gmail.com wrote: On Sep 14, 8:49 am, Bishan tvbis...@gmail.com wrote: i have a xml file.(pls see attachement). and i need insert data in my xml file to a sqlite database in my android project. hw can i do this ? Client.xml 18KViewDownload See http://groups.google.com/group/android-developers/browse_thread/thread/dec5475bcd98ea15/af98b5805d28e709#af98b5805d28e709 Skip the step about TextView and read something how to use sqlite in android app pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: XML files and SQLITE Database
any other answers ? On 9/14/11, Bishan tvbis...@gmail.com wrote: thanx skink. i'll try this. :) On Wed, Sep 14, 2011 at 12:33 PM, skink psk...@gmail.com wrote: On Sep 14, 8:49 am, Bishan tvbis...@gmail.com wrote: i have a xml file.(pls see attachement). and i need insert data in my xml file to a sqlite database in my android project. hw can i do this ? Client.xml 18KViewDownload See http://groups.google.com/group/android-developers/browse_thread/thread/dec5475bcd98ea15/af98b5805d28e709#af98b5805d28e709 Skip the step about TextView and read something how to use sqlite in android app pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: XML files and SQLITE Database
On Sep 14, 9:31 am, Bishan tvbis...@gmail.com wrote: any other answers ? On 9/14/11, Bishan tvbis...@gmail.com wrote: thanx skink. i'll try this. :) On Wed, Sep 14, 2011 at 12:33 PM, skink psk...@gmail.com wrote: On Sep 14, 8:49 am, Bishan tvbis...@gmail.com wrote: i have a xml file.(pls see attachement). and i need insert data in my xml file to a sqlite database in my android project. hw can i do this ? Client.xml 18KViewDownload See http://groups.google.com/group/android-developers/browse_thread/threa... Skip the step about TextView and read something how to use sqlite in android app pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en nope. nobody is gonna do your homework and post full working code unless you show what you have done so far and ask whats wrong in your code. pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: XML files and SQLITE Database
k. i got it skink. i know how to read XML. but the problem is how could i insert the data in XML to the my sqlite database table after reading the XML. that's the point whats wrong with me. On 9/14/11, skink psk...@gmail.com wrote: On Sep 14, 9:31 am, Bishan tvbis...@gmail.com wrote: any other answers ? On 9/14/11, Bishan tvbis...@gmail.com wrote: thanx skink. i'll try this. :) On Wed, Sep 14, 2011 at 12:33 PM, skink psk...@gmail.com wrote: On Sep 14, 8:49 am, Bishan tvbis...@gmail.com wrote: i have a xml file.(pls see attachement). and i need insert data in my xml file to a sqlite database in my android project. hw can i do this ? Client.xml 18KViewDownload See http://groups.google.com/group/android-developers/browse_thread/threa... Skip the step about TextView and read something how to use sqlite in android app pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en nope. nobody is gonna do your homework and post full working code unless you show what you have done so far and ask whats wrong in your code. pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: XML files and SQLITE Database
Bishan wrote: k. i got it skink. i know how to read XML. but the problem is how could i insert the data in XML to the my sqlite database table after reading the XML. that's the point whats wrong with me. On 9/14/11, skink psk...@gmail.com wrote: On Sep 14, 9:31 am, Bishan tvbis...@gmail.com wrote: any other answers ? On 9/14/11, Bishan tvbis...@gmail.com wrote: thanx skink. i'll try this. :) On Wed, Sep 14, 2011 at 12:33 PM, skink psk...@gmail.com wrote: On Sep 14, 8:49 am, Bishan tvbis...@gmail.com wrote: i have a xml file.(pls see attachement). and i need insert data in my xml file to a sqlite database in my android project. hw can i do this ? Client.xml 18KViewDownload See http://groups.google.com/group/android-developers/browse_thread/threa... Skip the step about TextView and read something how to use sqlite in android app pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en nope. nobody is gonna do your homework and post full working code unless you show what you have done so far and ask whats wrong in your code. pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en Ok here you have docs: http://developer.android.com/guide/topics/data/data-storage.html#db I assume you already read it, so what have you tried so far? pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: XML files and SQLITE Database
Bishan wrote: k. i got it skink. i know how to read XML. but the problem is how could i insert the data in XML to the my sqlite database table after reading the XML. that's the point whats wrong with me. On 9/14/11, skink psk...@gmail.com wrote: On Sep 14, 9:31 am, Bishan tvbis...@gmail.com wrote: any other answers ? On 9/14/11, Bishan tvbis...@gmail.com wrote: thanx skink. i'll try this. :) On Wed, Sep 14, 2011 at 12:33 PM, skink psk...@gmail.com wrote: On Sep 14, 8:49 am, Bishan tvbis...@gmail.com wrote: i have a xml file.(pls see attachement). and i need insert data in my xml file to a sqlite database in my android project. hw can i do this ? Client.xml 18KViewDownload See http://groups.google.com/group/android-developers/browse_thread/threa... Skip the step about TextView and read something how to use sqlite in android app pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en nope. nobody is gonna do your homework and post full working code unless you show what you have done so far and ask whats wrong in your code. pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: XML files and SQLITE Database
Bishan, you can google 'android sqlite example'...you'll get many working example codesmight help you. Thanks. -Shamim On Wed, Sep 14, 2011 at 3:03 PM, skink psk...@gmail.com wrote: Bishan wrote: k. i got it skink. i know how to read XML. but the problem is how could i insert the data in XML to the my sqlite database table after reading the XML. that's the point whats wrong with me. On 9/14/11, skink psk...@gmail.com wrote: On Sep 14, 9:31 am, Bishan tvbis...@gmail.com wrote: any other answers ? On 9/14/11, Bishan tvbis...@gmail.com wrote: thanx skink. i'll try this. :) On Wed, Sep 14, 2011 at 12:33 PM, skink psk...@gmail.com wrote: On Sep 14, 8:49 am, Bishan tvbis...@gmail.com wrote: i have a xml file.(pls see attachement). and i need insert data in my xml file to a sqlite database in my android project. hw can i do this ? Client.xml 18KViewDownload See http://groups.google.com/group/android-developers/browse_thread/threa... Skip the step about TextView and read something how to use sqlite in android app pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en nope. nobody is gonna do your homework and post full working code unless you show what you have done so far and ask whats wrong in your code. pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: XML files and SQLITE Database
currently i'm reading XML file and put data into a Vector Object. but i don't know how could i insert the data in that Vector Object into sqlite database. this is the point where i stuck. On 9/14/11, skink psk...@gmail.com wrote: Bishan wrote: k. i got it skink. i know how to read XML. but the problem is how could i insert the data in XML to the my sqlite database table after reading the XML. that's the point whats wrong with me. On 9/14/11, skink psk...@gmail.com wrote: On Sep 14, 9:31 am, Bishan tvbis...@gmail.com wrote: any other answers ? On 9/14/11, Bishan tvbis...@gmail.com wrote: thanx skink. i'll try this. :) On Wed, Sep 14, 2011 at 12:33 PM, skink psk...@gmail.com wrote: On Sep 14, 8:49 am, Bishan tvbis...@gmail.com wrote: i have a xml file.(pls see attachement). and i need insert data in my xml file to a sqlite database in my android project. hw can i do this ? Client.xml 18KViewDownload See http://groups.google.com/group/android-developers/browse_thread/threa... Skip the step about TextView and read something how to use sqlite in android app pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en nope. nobody is gonna do your homework and post full working code unless you show what you have done so far and ask whats wrong in your code. pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: XML files and SQLITE Database
thanx Shamim :) On 9/14/11, Bishan tvbis...@gmail.com wrote: currently i'm reading XML file and put data into a Vector Object. but i don't know how could i insert the data in that Vector Object into sqlite database. this is the point where i stuck. On 9/14/11, skink psk...@gmail.com wrote: Bishan wrote: k. i got it skink. i know how to read XML. but the problem is how could i insert the data in XML to the my sqlite database table after reading the XML. that's the point whats wrong with me. On 9/14/11, skink psk...@gmail.com wrote: On Sep 14, 9:31 am, Bishan tvbis...@gmail.com wrote: any other answers ? On 9/14/11, Bishan tvbis...@gmail.com wrote: thanx skink. i'll try this. :) On Wed, Sep 14, 2011 at 12:33 PM, skink psk...@gmail.com wrote: On Sep 14, 8:49 am, Bishan tvbis...@gmail.com wrote: i have a xml file.(pls see attachement). and i need insert data in my xml file to a sqlite database in my android project. hw can i do this ? Client.xml 18KViewDownload See http://groups.google.com/group/android-developers/browse_thread/threa... Skip the step about TextView and read something how to use sqlite in android app pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en nope. nobody is gonna do your homework and post full working code unless you show what you have done so far and ask whats wrong in your code. pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: XML files and SQLITE Database
On Sep 14, 11:29 am, Bishan tvbis...@gmail.com wrote: currently i'm reading XML file and put data into a Vector Object. but i don't know how could i insert the data in that Vector Object into sqlite database. this is the point where i stuck. On 9/14/11, skink psk...@gmail.com wrote: Bishan wrote: k. i got it skink. i know how to read XML. but the problem is how could i insert the data in XML to the my sqlite database table after reading the XML. that's the point whats wrong with me. On 9/14/11, skink psk...@gmail.com wrote: On Sep 14, 9:31 am, Bishan tvbis...@gmail.com wrote: any other answers ? On 9/14/11, Bishan tvbis...@gmail.com wrote: thanx skink. i'll try this. :) On Wed, Sep 14, 2011 at 12:33 PM, skink psk...@gmail.com wrote: On Sep 14, 8:49 am, Bishan tvbis...@gmail.com wrote: i have a xml file.(pls see attachement). and i need insert data in my xml file to a sqlite database in my android project. hw can i do this ? Client.xml 18KViewDownload See http://groups.google.com/group/android-developers/browse_thread/threa... Skip the step about TextView and read something how to use sqlite in android app pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en nope. nobody is gonna do your homework and post full working code unless you show what you have done so far and ask whats wrong in your code. pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en And your code is...? pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: XML files and SQLITE Database
VectorEgCommon vClient = new VectorEgCommon(); for (int temp = 0; temp getNodes().getLength(); temp++) { Node nNode = getNodes().item(temp); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) nNode; Client cl = new Client( Util.getTagValue(clientID, element), Util.getTagValue(clientName, element), Util.getTagValue(routeName, element), Util.getTagValue(visitingFrequency, element), Util.getTagValue(creditLimit, element), Util.getTagValue(outletType, element), Util.getTagValue(shopGrade, element), Util.getTagValue(creditPeriodDays, element), Util.getTagValue(streetNumber, element), Util.getTagValue(streetName, element), Util.getTagValue(city, element), Util.getTagValue(district, element), Util.getTagValue(csrId, element), Util.getTagValue(comments, element), Util.getTagValue(active, element)); vClient.add(cl); } } return vClient; } On 9/14/11, skink psk...@gmail.com wrote: On Sep 14, 11:29 am, Bishan tvbis...@gmail.com wrote: currently i'm reading XML file and put data into a Vector Object. but i don't know how could i insert the data in that Vector Object into sqlite database. this is the point where i stuck. On 9/14/11, skink psk...@gmail.com wrote: Bishan wrote: k. i got it skink. i know how to read XML. but the problem is how could i insert the data in XML to the my sqlite database table after reading the XML. that's the point whats wrong with me. On 9/14/11, skink psk...@gmail.com wrote: On Sep 14, 9:31 am, Bishan tvbis...@gmail.com wrote: any other answers ? On 9/14/11, Bishan tvbis...@gmail.com wrote: thanx skink. i'll try this. :) On Wed, Sep 14, 2011 at 12:33 PM, skink psk...@gmail.com wrote: On Sep 14, 8:49 am, Bishan tvbis...@gmail.com wrote: i have a xml file.(pls see attachement). and i need insert data in my xml file to a sqlite database in my android project. hw can i do this ? Client.xml 18KViewDownload See http://groups.google.com/group/android-developers/browse_thread/threa... Skip the step about TextView and read something how to use sqlite in android app pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en nope. nobody is gonna do your homework and post full working code unless you show what you have done so far and ask whats wrong in your code. pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en And your code is...? pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups
[android-developers] Re: XML files and SQLITE Database
On Sep 14, 12:15 pm, Bishan tvbis...@gmail.com wrote: VectorEgCommon vClient = new VectorEgCommon(); for (int temp = 0; temp getNodes().getLength(); temp++) { Node nNode = getNodes().item(temp); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) nNode; Client cl = new Client( Util.getTagValue(clientID, element), Util.getTagValue(clientName, element), Util.getTagValue(routeName, element), Util.getTagValue(visitingFrequency, element), Util.getTagValue(creditLimit, element), Util.getTagValue(outletType, element), Util.getTagValue(shopGrade, element), Util.getTagValue(creditPeriodDays, element), Util.getTagValue(streetNumber, element), Util.getTagValue(streetName, element), Util.getTagValue(city, element), Util.getTagValue(district, element), Util.getTagValue(csrId, element), Util.getTagValue(comments, element), Util.getTagValue(active, element)); vClient.add(cl); } } return vClient; } man, i dont mean xml stuff as its already working, i mean your sqlite stuff, how do you try to insert data into your db? pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: XML files and SQLITE Database
SQLiteDatabase db = openOrCreateDatabase(TestDB, MODE_PRIVATE, null); db.execSQL(CREATE TABLE IF NOT EXISTS Client (clientID INT, + clientName VARCHAR, + routeName VARCHAR, + visitingFrequency INT, + creditLimit INT, + outletType VARCHAR, + shopGrade VARCHAR, + creditPeriodDays INT(2), + streetNumber VARCHAR, + streetName VARCHAR, + city VARCHAR, + district VARCHAR, + csrId INT, + comments VARCHAR, + active VARCHAR(1))); db.execSQL(INSERT INTO Client VALUES (110001, + 'LASANTHA STORES', + 'R1', + 4, + 0, + 'GROCERY', + 'BRONZE', + 4, + '2', + 'HIGHL LEVEL ROAD', + 'MAHARAGAMA', + 'COLOMBO', + 1091, + 'Test Client', + 'Y')); db.close(); tried above one and it's worked. now i need to insert data in XML to my database. i know how to read XML file and get values in xml elements. but have no idea about how to insert them into database. On 9/14/11, skink psk...@gmail.com wrote: On Sep 14, 12:15 pm, Bishan tvbis...@gmail.com wrote: VectorEgCommon vClient = new VectorEgCommon(); for (int temp = 0; temp getNodes().getLength(); temp++) { Node nNode = getNodes().item(temp); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) nNode; Client cl = new Client( Util.getTagValue(clientID, element), Util.getTagValue(clientName, element), Util.getTagValue(routeName, element), Util.getTagValue(visitingFrequency, element), Util.getTagValue(creditLimit, element), Util.getTagValue(outletType, element), Util.getTagValue(shopGrade, element), Util.getTagValue(creditPeriodDays, element), Util.getTagValue(streetNumber, element), Util.getTagValue(streetName, element), Util.getTagValue(city, element), Util.getTagValue(district, element), Util.getTagValue(csrId, element), Util.getTagValue(comments, element), Util.getTagValue(active, element)); vClient.add(cl); } } return vClient; } man, i dont mean xml stuff as its already working, i mean your sqlite stuff, how do you try to insert data into your db? pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: XML files and SQLITE Database
On Sep 14, 1:07 pm, Bishan tvbis...@gmail.com wrote: SQLiteDatabase db = openOrCreateDatabase(TestDB, MODE_PRIVATE, null); db.execSQL(CREATE TABLE IF NOT EXISTS Client (clientID INT, + clientName VARCHAR, + routeName VARCHAR, + visitingFrequency INT, + creditLimit INT, + outletType VARCHAR, + shopGrade VARCHAR, + creditPeriodDays INT(2), + streetNumber VARCHAR, + streetName VARCHAR, + city VARCHAR, + district VARCHAR, + csrId INT, + comments VARCHAR, + active VARCHAR(1))); db.execSQL(INSERT INTO Client VALUES (110001, + 'LASANTHA STORES', + 'R1', + 4, + 0, + 'GROCERY', + 'BRONZE', + 4, + '2', + 'HIGHL LEVEL ROAD', + 'MAHARAGAMA', + 'COLOMBO', + 1091, + 'Test Client', + 'Y')); db.close(); tried above one and it's worked. now i need to insert data in XML to my database. i know how to read XML file and get values in xml elements. but have no idea about how to insert them into database. Have you read docs of SQLiteDatabase? There is a method for row inserting. Also why dont you use SQLiteDatabaseHelper which is recommended way of creating/ugrading/accessing of database? pskink -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: XML files and SQLITE Database
Hi Bishan I hope is helpful private var sqlc:SQLConnection = new SQLConnection(); // sqlc is an SQLStatment which we need to execute our sql commands private var sqls:SQLStatement = new SQLStatement(); // ArrayCollection used as a data provider for the datagrid. It has to be bindable so that data in datagrid changes automatically when we change the ArrayCollection private var dp:ArrayCollection = new ArrayCollection(); private function start():void { var folder:File = File.applicationDirectory; var db:File = folder.resolvePath(test.bd); // first we need to set the file class for our database (in this example test.db). If the Database doesn't exists it will be created when we open it. //var db:File = File.applicationStorageDirectory.resolvePath(test.db); // after we set the file for our database we need to open it with our SQLConnection. sqlc.openAsync(db); // we need to set some event listeners so we know if we get an sql error, when the database is fully opened and to know when we recive a resault from an sql statment. The last one is uset to read data out of database. sqlc.addEventListener(SQLEvent.OPEN, db_opened); sqlc.addEventListener(SQLErrorEvent.ERROR, error); sqls.addEventListener(SQLErrorEvent.ERROR, error); sqls.addEventListener(SQLEvent.RESULT, resault); } private function db_opened(e:SQLEvent):void { // when the database is opened we need to link the SQLStatment to our SQLConnection, so that sql statments for the right database. // if you don't set this connection you will get an error when you execute sql statment. sqls.sqlConnection = sqlc; // in property text of our SQLStatment we write our sql command. We can also combine sql statments in our text property so that more than one statment can be executed at a time. // in this sql statment we create table in our database with name test_table with three columns (id, first_name and last_name). Id is an integer that is auto incremented when each item is added. First_name and last_name are columns in which we can store text // If you want to know more about sql statments search the web. sqls.text = CREATE TABLE IF NOT EXISTS test_table ( id INTEGER PRIMARY KEY AUTOINCREMENT, first_name TEXT, last_name TEXT);; // after we have connected sql statment to our sql connection and writen our sql commands we also need to execute our sql statment. // nothing will change in database until we execute sql statment. sqls.execute(); // after we load the database and create the table if it doesn't already exists, we call refresh method which i have created to populate our datagrid refresh(); } private function addItem():void { // in this sql statment we add item at the end of our table with values first_name.text in column first_name and last_name.text for column last_name sqls.text = INSERT INTO test_table (first_name, last_name) VALUES('+first_name.text+','+last_name.text+');; sqls.execute(); refresh(); } private function refresh(e:TimerEvent = null):void { // timer object which we need if sql statment is still executing so that we can try again after 10 milliseconds. var timer:Timer = new Timer(10,1); timer.addEventListener(TimerEvent.TIMER, refresh); if ( !sqls.executing )// we need to check if our sql statment is still executing our last sql command. If so we use Timer to try again in 10 milliseconds. If we wouldn't check we could get an error because SQLStatment can't execute two statments at the same time. { // sql statment which returns all the data from our test_table. To retrive only data from first_name and last_name columns we would use SELECT first_name,last_name FROM test_table sqls.text = SELECT * FROM test_table sqls.execute(); } else { timer.start(); } } private function resault(e:SQLEvent):void { // with sqls.getResault().data we get the array of objects for each row out of our database var data:Array = sqls.getResult().data; // we pass the array of objects to our data provider to fill the datagrid dp = new ArrayCollection(data); } // method to remove row from database. private function remove():void { // sql statment to delete from our test_table the row that has the same number in number column as our selected row from datagrid sqls.text = DELETE FROM test_table WHERE id=+dp[dg.selectedIndex].id; sqls.execute(); refresh(); } 2011/9/14 lbendlin l...@bendlin.us you seem to have a fundamental problem here. SQLite is a RELATIONAL database. XML is HIERARCHICAL. The Mericans would say trying to push a square peg in a round hole Before you can insert the XML data into SQLite you either need to flatten the data, or indicate a parent/child relationship between entries, or simply store the whole XML as a string. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit
Re: [android-developers] Re: XML files and SQLITE Database
thanx Cristhian. i'll check this. On 9/15/11, Cristhian Flores cif...@gmail.com wrote: Hi Bishan I hope is helpful private var sqlc:SQLConnection = new SQLConnection(); // sqlc is an SQLStatment which we need to execute our sql commands private var sqls:SQLStatement = new SQLStatement(); // ArrayCollection used as a data provider for the datagrid. It has to be bindable so that data in datagrid changes automatically when we change the ArrayCollection private var dp:ArrayCollection = new ArrayCollection(); private function start():void { var folder:File = File.applicationDirectory; var db:File = folder.resolvePath(test.bd); // first we need to set the file class for our database (in this example test.db). If the Database doesn't exists it will be created when we open it. //var db:File = File.applicationStorageDirectory.resolvePath(test.db); // after we set the file for our database we need to open it with our SQLConnection. sqlc.openAsync(db); // we need to set some event listeners so we know if we get an sql error, when the database is fully opened and to know when we recive a resault from an sql statment. The last one is uset to read data out of database. sqlc.addEventListener(SQLEvent.OPEN, db_opened); sqlc.addEventListener(SQLErrorEvent.ERROR, error); sqls.addEventListener(SQLErrorEvent.ERROR, error); sqls.addEventListener(SQLEvent.RESULT, resault); } private function db_opened(e:SQLEvent):void { // when the database is opened we need to link the SQLStatment to our SQLConnection, so that sql statments for the right database. // if you don't set this connection you will get an error when you execute sql statment. sqls.sqlConnection = sqlc; // in property text of our SQLStatment we write our sql command. We can also combine sql statments in our text property so that more than one statment can be executed at a time. // in this sql statment we create table in our database with name test_table with three columns (id, first_name and last_name). Id is an integer that is auto incremented when each item is added. First_name and last_name are columns in which we can store text // If you want to know more about sql statments search the web. sqls.text = CREATE TABLE IF NOT EXISTS test_table ( id INTEGER PRIMARY KEY AUTOINCREMENT, first_name TEXT, last_name TEXT);; // after we have connected sql statment to our sql connection and writen our sql commands we also need to execute our sql statment. // nothing will change in database until we execute sql statment. sqls.execute(); // after we load the database and create the table if it doesn't already exists, we call refresh method which i have created to populate our datagrid refresh(); } private function addItem():void { // in this sql statment we add item at the end of our table with values first_name.text in column first_name and last_name.text for column last_name sqls.text = INSERT INTO test_table (first_name, last_name) VALUES('+first_name.text+','+last_name.text+');; sqls.execute(); refresh(); } private function refresh(e:TimerEvent = null):void { // timer object which we need if sql statment is still executing so that we can try again after 10 milliseconds. var timer:Timer = new Timer(10,1); timer.addEventListener(TimerEvent.TIMER, refresh); if ( !sqls.executing )// we need to check if our sql statment is still executing our last sql command. If so we use Timer to try again in 10 milliseconds. If we wouldn't check we could get an error because SQLStatment can't execute two statments at the same time. { // sql statment which returns all the data from our test_table. To retrive only data from first_name and last_name columns we would use SELECT first_name,last_name FROM test_table sqls.text = SELECT * FROM test_table sqls.execute(); } else { timer.start(); } } private function resault(e:SQLEvent):void { // with sqls.getResault().data we get the array of objects for each row out of our database var data:Array = sqls.getResult().data; // we pass the array of objects to our data provider to fill the datagrid dp = new ArrayCollection(data); } // method to remove row from database. private function remove():void { // sql statment to delete from our test_table the row that has the same number in number column as our selected row from datagrid sqls.text = DELETE FROM test_table WHERE id=+dp[dg.selectedIndex].id; sqls.execute(); refresh(); } 2011/9/14 lbendlin l...@bendlin.us you seem to have a fundamental problem here. SQLite is a RELATIONAL database. XML is HIERARCHICAL. The Mericans would say trying to push a square peg in a round hole Before you can insert the XML data into SQLite you either need to flatten the data, or indicate a parent/child relationship between entries, or simply store the whole XML as a string. -- You received this message because you are subscribed to the Google Groups Android Developers group. To