Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 1, 2008, 08:07 PM   #1
mekopolis
macrumors regular
 
Join Date: Feb 2008
SQLite linking/retrieving from a database help

Im sorry I accidently posted this in the mac programming forum, but it has to do with programming for the iphone


I'm new to Programming on a Mac platform and on the OS X / iphone SDK
so forgive me if this isn't blatantly obvious
i am designing an app that connects to a database to display its contents
after researching it a bit, and even playing around in the CoreData interface, I read this from Apple's Developer Page:


"How do I bundle an SQLite database with my application?

Add the existing database file to your Xcode project as you would any other resource file by dragging it to the "Resources" group in the project's Files view. When prompted, make sure you add it to the appropriate Target (if your project has more than one). The file will be copied into the application bundle when you build your project.

This is all you need to do if your database is meant to be read-only."

So I designed a Database in SQLite, and imported it into the Project

How do I link it, and retrieve data/ display it on either a table view controller or even a label.

thanks
mekopolis is offline   0 Reply With Quote
Old Sep 1, 2008, 10:30 PM   #2
beachdog
macrumors member
 
Join Date: Aug 2008
Check out the SQLiteBooks sample, it should get you started. Also www.sqlite.org
beachdog is offline   0 Reply With Quote
Old Mar 9, 2010, 02:52 AM   #3
ejaa
macrumors newbie
 
Join Date: Mar 2010
how i can updating my database on sqlite3?

please.
I am new in xcode programming.

Now, my friends and i were trying to update some of the database on xcode.
We're tried using sqlite manager adds on firefox, but it failed.
We are able to change the database in the .sqlite file, but when we are trying to run on the code, it still remains the same.


anyone??
ejaa is offline   0 Reply With Quote
Old Mar 9, 2010, 12:19 PM   #4
boyplunder
macrumors regular
 
Join Date: Sep 2008
Location: UK
ejaa, the problem you may have found is that most examples show sqlite being used for a database where the user updates it in the app. If you just want to use the data 'as is' you have to remember that the database is likely being written to the app's folder on the iPhone or iPod. This is because the database can't be updated in the app bundle, so it has to be saved out to be updated.

Have a look at this tutorial. It shows the typical use for a database where the user enters new details.
iphonesdkarticles.com

Look out for the NSFilemanager code, which does the work. All you have to do is modify this example to retain the database and load it every time the app starts up.

That said, the latest thing to do is to use Coredata, but I find that it isn't always the best way to go with all apps and all database uses.

ADDED: I use the SQL plugin with FireFox and it works very well. My point above is probably the reason it seems to have failed.

Last edited by boyplunder; Mar 9, 2010 at 12:23 PM. Reason: Additional text
boyplunder is offline   0 Reply With Quote
Old Mar 10, 2010, 10:08 PM   #5
ejaa
macrumors newbie
 
Join Date: Mar 2010
thanks alot boyplunder.


i will try my best.


later if i had problems, i'll refer on macrumors.
ejaa is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
GW2 Database- iPhone and iPad database for Guild Wars 2 skoroapps iPad Apps 19 Jul 20, 2013 06:59 AM
GW2 Database - iPhone and iPad database for Guild Wars 2 skoroapps iPhone and iPod touch Apps 14 Jul 20, 2013 06:58 AM
Retrieving from iCloud Avaj iCloud and Apple Services 2 Sep 22, 2012 01:59 AM
Sqlite3 database Standards and properties : From .CSV or .XLS to .sqlite in Xcode 4.3 EliasRahme iPhone/iPad Programming 0 Jul 21, 2012 02:53 AM
Using Core Data to fetch record from SQLite database. kimbebot iPhone/iPad Programming 3 Jun 29, 2012 11:04 AM

Forum Jump

All times are GMT -5. The time now is 11:10 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC