I create app and all work fine
Need to replace string instead local database to be cloud database
Data in table database are same
New string is:
Data Source=94.251.1.1,1433;Initial Catalog="BCC";User ID=admin;Password=admin
My existing local database data
C#
SQLiteConnection con;
public SQLiteConnection GetConnectionWithCreateDatabase()
{
string fileName = "sampleDatabase.db3";
string documentPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
string path = Path.Combine(documentPath, fileName);
con = new SQLiteConnection(path);
con.CreateTable();
return con;
}
Ali BenchaabanRank #925 · 2.2K reputationPosted Sep 8, 2023, 6:13 AM EDT
Hello,
To replace your existing local SQLite database with a cloud database, bellow the code
using System.Data; using System.Data.SqlClient; public SqlConnection GetSqlConnection() { string connectionString = "Data Source=94.251.1.1,1433;Initial Catalog=BCC;User ID=admin;Password=admin"; SqlConnection sqlConnection = new SqlConnection(connectionString); sqlConnection.Open(); return sqlConnection; }As advice, think always to keep your connection strings in separate file such as appsettings.json.
Regards,