
May 26, 2025 09:11 by
Peter
We'll talk about creating a basic SQLite DB application with a login page here, using MAUI (Multi-platform App UI). The SQLite Database will be used to develop logic using a SQLite helper class. First, we'll use Visual Studio 2022 to build an MAUI App project. The project will produce a single home page similar to the one below.

Following that, some basic login and registration xaml pages will be created. The SQLiteHelper class for database activity will then be created. Install the NuGet package's Microsoft.Data.Sqlite package.
public class SQLiteHelper
{
private string dbPath;
public SQLiteHelper()
{
dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "users.db");
InitializeDatabase();
}
private void InitializeDatabase()
{
using var connection = new SqliteConnection($"Data Source={dbPath}");
connection.Open();
var command = connection.CreateCommand();
command.CommandText =
@"
CREATE TABLE IF NOT EXISTS Users (
Id INTEGER PRIMARY KEY AUTOINCREMENT,
Username TEXT NOT NULL,
Password TEXT NOT NULL
);
";
command.ExecuteNonQuery();
}
}
Login page Example given below.
public partial class LoginPage : ContentPage
{
private SQLiteHelper dbHelper = new();
public LoginPage()
{
InitializeComponent();
}
private void OnLoginClicked(object sender, EventArgs e)
{
if (dbHelper.ValidateUser(UsernameEntry.Text, PasswordEntry.Text))
DisplayAlert("Success", "Login successful!", "OK");
else
DisplayAlert("Error", "Invalid credentials.", "OK");
}
private void OnGoToRegisterClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new RegisterPage());
}
}
Go to App.xaml.cs page adds the Login page as main page like launch view as mention below example
namespace MauiApp1
{
public partial class App : Application
{
public App()
{
InitializeComponent();
//MainPage = new AppShell();
MainPage = new NavigationPage(new LoginPage());
}
}
}
Output


European Best, cheap and reliable ASP.NET hosting with instant activation. HostForLIFE.eu is #1 Recommended Windows and ASP.NET hosting in European Continent. With 99.99% Uptime Guaranteed of Relibility, Stability and Performace. HostForLIFE.eu security team is constantly monitoring the entire network for unusual behaviour. We deliver hosting solution including Shared hosting, Cloud hosting, Reseller hosting, Dedicated Servers, and IT as Service for companies of all size.
