how to add sqlite databse to my xamarin.forms shared project,
i need to implement a user login system where it can store the user details and validate username and password then display the profile page.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suresh RajanaPosted Mar 10, 2017, 6:51 AM
Girjesh KumarPosted Mar 10, 2017, 6:32 AM
What is SQLite?
SQLite database has methods to create, delete, and execute SQL commands, and perform other common database management tasks. More details.
Let’s start,
Step 1
Open Visual Studio->New Project->Templates->Visual C#->Android->Blank App.
Select Blank App. Give the project name and the project location.

Step 2
Step 3
Go to Solution Explorer-> Project Name. Right click on Add. Open new dialog box. Select Activity and give name for RegisterActivity.cs. Now, add the New Activity Class.

Step 4
Next, we need to create the database table, so we create one Data Layer class. Go to Solution Explorer-> Project Name. Right click to Add. Open new dialog box. Select Class, give name for LoginTable.cs and after it, add New Class.

Step 5
Go to Solution Explorer-> Project Name-> References. Right Click to manage Nuget Packages and open new dialog box. This dialog box searches SQLite. Install SQLite-Net Packages.

Next, Open the Solution Explorer-> Project Name->Resources->Layout->Main.axml. Click Open Design View. Here, create large text, two plain text and two buttons.
Step 7
Next step is to Open Solution Explorer-> Project Name->Resources->Layout->Newuser.axml, click Open Design View. Here, create large text, two plain text and one button.
Step 8
Next is to open Solution Explorer-> Project Name->LoginTable.cs, click Open CS code Page View and create table columns.
Step 9
Now, open Solution Explorer-> Project Name->MainActivity.cs, click Open CS code Page view and add the following namespaces. First, we create database. So, after OnCreate(), create new method with name of CreateDB().
C# Code
Here, the database name is “user.db3”.
Step 10
Next, open Solution Explorer-> Project Name-> RegisterActivity.cs. Click Open CS code Page view, then add the below namespaces. Next, write the following code.
C# Code
Press F5 or build and run the Application. First image is to register the new user and then, the next image is to login the user.
Finally, we successfully created login using SQLite database.