How to reference SQLite database that already exists in Xamarin.Android? - sqlite

I have created SQLite database and have copied it in the root of the project like that:
The database is called MobileSell.db It appears in Visual Studio like that:
My question is how can I reference it so afterwards I can say connection.InsertIntoTableArticles(value)(this is pseudo code)

You can refer to this.
There only three steps to achieve it:
1) Create Assets folder which is parallel with Resources folder in your project, put your .db file into it.
2) Copy the .db file to SDCard when first open the app;
3) Use SQLite.SQLiteConnection(path) to open your .db and query it.

Related

Xamarin (Forms): how to download and use an SQLite DB file

my client has a simple SQLite DB exposed through an URL (direct download of the DB entire file).
What I have to do is to download the file and then use it in my app: Android and iOS.
I am already able to use the same DB locally: I have a copy of the same file that is online (not updated) in my assets and resource folders and I can use the data in it inside my app. The DB structure won't change; the file is updated every night to reflect the changes in their DB, so only record updates/additions/removals.
Anyone can give me any advice on how to achieve this result?
Since you already have a url of this data file, then you need to separately download this file and save it to local on each platform, and use DependencyService to call the method of each platform in your portable lib.
For the example of using DependencyService, you can refer to Saving and Loading Files.
For the downloading part, you can use some plugins for example like CrossDownloadManager, which may make your work easier.
Or if you want to complement this work in your PCL, you can add a System.Net.Http reference in your PCL, then use HttpClient to download your database file, but you still need to use DependencyService to save this file on different platforms.

Visual Studio import .publishsettings for File System

Where/How do you create a .publishsettings file, so you can import a common configuration for all of your local, test deployments?
I want to publish another site locally to my computer via Visual Studio to C:\Webs\TheSite. Every time I do this for a new site, I have to create a new custom profile and go through and click all the checkboxes etc.
I would rather start by importing a pre-configured .publishsettings file, and just change TheSite in the destination path.
However, I can only find instructions for Azure and FTP/WebDeploy:
http://gauravmantri.com/2012/09/14/about-windows-azure-publish-settings-file-and-how-to-create-your-own-publish-settings-file/
http://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-get-started/
http://www.iis.net/learn/web-hosting/joining-the-web-hosting-gallery/generate-a-profile-xml-file
Surprisingly answer to this simple question is so hard to find. I wasted hours searching answer to this to save minutes in creating new profile. Well then I never knew it would take so much time.
The simple hack is to copy the "PublishProfiles" folder from previous project (from where you want to get publish profile) and paste it in present project in "MyProject" folder.
If you already have "PublishProfiles" folder in present project then copy only the relevant xxx.pubxml and xxx.pubxml,user files from previous project.
Then open the profile and edit it as you like.

How do I share Notepad++ snippets (nppsnippets) with others

I have setup a number of custom snippet libraries with the nppsnippets plugin.
I can see where it has the ability to import sqlite files, but I don't see what file(s) to share if I would like to let associates use the libraries I created.
Ideally I would like to share a subset of the libraries I created.
Thanks
This plugin creates a sqlite database within your %appdata%/Notepad++/plugins/config/ folder named NppSnippets.sqlite.
While Notepad++ is closed, you can overwrite the entire database in your associates appdata folder with the one you have, and the next time Notepad++ is opened, it will have your library in their application. Alternatively, you can have them use the built-in import tool within notepad++ to import particular libraries from your SQLite database.

how to convert .sou file to .sln

I downloded asp.net file but it shows in .sou extension it is not opend in my vs2008 how can i convert .sou file to .sln
The .sou file isn't the equivalent of a .sln file. They do different things.
In your Visual Studio go to File -> Open Website and navigate to your folder instead.
You can't. .sln files store completely different data than .suo files.
From MSDN:
.sln: Organizes projects, project items and solution items into the solution by providing the environment with references to their locations on disk.
.suo: Records all of the options that you might associate with your solution so that each time you open it, it includes customizations that you have made.
Looks like the .sou file and .sln files ccontain different info. See descriptions here
http://msdn.microsoft.com/en-us/library/xhkhh4zs.aspx It won't contain information that can converted.
The best way is to create a blank solution file and add the existing projects to it one by one.

Compile .dbml file into separate assembly

I have a website project, and using Linq to SQL in it. Currently, I have my .dbml file in the App_Code directory, but I want to separate it out into a different project in order to compile it into a separate dll; is it possible?
I tried adding a DB project to my solution, but didn't have much luck with it.
Yes, it is possible.
Just create a new project of type class library, and copy and paste your .dbml into the new project. Add a reference to the new project (class library) on your website project in the end.
I believe that a DB project is just a way to store SQL Scripts to be executed against a DB.

Resources