I create my first mobile app in Xamarin Forms. As I'm a C#.NET developer, I was thinking straight forward methods to manage with databases.
I have a pre-loaded database "MyStoryTitles.db3", and I just want to show the contents.
My thinking was to:
store the db3 file in a folder named Data
connect to the file
use list view to show the content
But when I researched, I came to know that we cannot do the SQLite in straight forward methods. What I understood from the online articles that I have to:
store the db3 file as Asset ( for Android)
copy the file prior opening it ( as shown here)
connect to the local copied db
use list view to show the content
Is this the standard procedure ? Or can I store the db3 file as EmbeddedResource and do the database operation as normal ?
Related
I wanted to fill a SQLite database with some initial data required for my app so I made a flutter app and used it to fill generate that database with the SQFLite package and then took it and put it in the assets folder of the app it will be used in, but when I query the initial data table it tells me that the table doesn't exist although the file size says that there is data in there and I used an online SQLite viewer website and the table with the data were there, So what to do?!.
A quick way to dump an existing database is schema is:
print(await db.query("sqlite_master"));
Without code, hard to say whether you correctly open the database from your assets.
You should also check that the existing database has indeed the data using some 3rd party tool (sqlite3, sqlite browser).
I'm stepping through a walk through which allows me to create a dynamic data website.
Though in all the tutorials, including the one above, they all point to a local file based database. I need to add an external data model.
How could I add an external data model to the project? (A database hosted on a seperate SQL Server)
I've tried connecting through the SQL Server Object Explorer then dragging it into App_Data, but that didn't work.
Use the connection string in the web.config, but as you add the EF data model you should be given the opportunity to select you database by browsing for it.
I have a database from an existing android app that I need to import into my Windows Phone 8 app. Is the only way to do this to create some huge population script to be ran on the first loading of the app?
I am currently using the new sqlite-net-wp8 by Peter Huene as directed by this blog post. But the examples are all about creating the database, not using an existing one. Any help would be great.
This link shows how to copy an existing sqlite database in Windows 8. The ability to do it on a phone is the same.
1) Add the sqlite database into your project and set the type to content in its properties.
2) When your app loads, load the file into a storage file. Then write it back out using the localfolder as the destination.
WP8 only supports local (in local file) databases.
Check your solution and search for database file. If file does't exist then You can only copy by script.
I have an AIR application and I would like use SQLite instead of an XML file to populate the database. I've seen people create the database on the fly and import the data when the application first launches. But also people are using existing databases. What approach do you use to prepopulate the database? Is there a tool to enter basic initial data (~200 records and 2 tables) or should I create the database and contents manually when the app is first installed.
More context
This is a mobile AIR application using Flex 4.6.
There are numerous tools to manage SQLite databases, such as Lita which is an open source AIR application.
If there is no need to revert the database back to its original content, then it could simply be packaged in the app with your populated content.
If restoring the database to its original populated data is required, you could keep a copy of the original database and stage it to the active database in use, thereby replacing the database.
Depending on data and parity of your app to the database model, it wouldn't be unreasonable to populate your database via programmatic implementation in code executed at first launch. There is overhead both in initial launch of your app and perhaps mostly in code you must generate and maintain to create the database.
Typically, I would only follow this pattern if I have a default model with serialization of that model. As in, if I had already built a commit of preferences style data from my models to persist in a database.
I can create a sqlite DB in phonegap/html5 via window.openDatabase. I am going to have a large amount of data, so I want to ship it with the app.
So can I store a sqlite DB somewhere, within the app (It needs to work on both iOS and Android). I particular where is the shortName.db stored when I call
var db = openDatabase(shortName, version, displayName, maxSize);
And can I pre-populate this sqlite file. (In the phonegap environment)
Listed here are some solutions for iphone and android:
http://groups.google.com/group/phonegap/browse_thread/thread/5e57a728dc66a2a1?pli=1
I've not used PhoneGap, only created HTML5 apps that use Web SQL. However, if you're asking whether you can ship an app with a pre-populated SQLite database, then yes you can. Probably the simplest approach would be to provide the table creation scripts as part of the app. When it's first fired up, you can have the scripts run, and your database will then be fully initialised.
An alternative approach for deploying bulk data I came up is simply serialize it into text files and deploy the files together with the app.
You can use the File API provided by PhoneGap to load these files as strings, and parse them with Ext.util.JSON.decode().
Finally, use the MemoryProxy to integrate the decoded data with the rest of Sencha Touch and you are golden.