Local database, I need some examples
Depending on the needs you could also consider Sql CE. I'm sure that if you specified the database you're thinking of using, or your requirements if you're usure you would get proper and real examples of connection strings etc.
Edit: Here's code for SqlCe / Sql Compact
public void ConnectListAndSaveSQLCompactExample()
{
// Create a connection to the file datafile.sdf in the program folder
string dbfile = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName + "\\datafile.sdf";
SqlCeConnection connection = new SqlCeConnection("datasource=" + dbfile);
// Read all rows from the table test_table into a dataset (note, the adapter automatically opens the connection)
SqlCeDataAdapter adapter = new SqlCeDataAdapter("select * from test_table", connection);
DataSet data = new DataSet();
adapter.Fill(data);
// Add a row to the test_table (assume that table consists of a text column)
data.Tables[0].Rows.Add(new object[] { "New row added by code" });
// Save data back to the databasefile
adapter.Update(data);
// Close
connection.Close();
}
Remember to add a reference to System.Data.SqlServerCe
SQL Server Local and Public Database
You can use Azure SQL Data Sync bi-directional synchronization to keep in synch your cloud database and your local database. This way when a customer creates a case on your external site all related records will be replicated to the local database (member database) with the latency and frequency that you want. The same will happen when a case is updated in your local database, all related records will be replicated to your cloud database (hub database).
You don't need to create your own scripts for the synchronization to happen. SQL Data Sync will take care of that. To get started with SQL Data Sync please visit this documentation.
Local database to online database
While you haven't specified database, tools, the answer can be extraordinary as well.
Let's imagine that you have local MS SQL DB and Azure SQL db.
There is not a standard method how to do this.
Right click on the database. Generate scripts.
Then select all objects that you need
then go to advanced and change types of data to script to:Scheme and data
as the result you will have full damp of your database that you have to run on AZURE SQL.
ps. more ideas only if you provide more details
How to use a local database in c#?
First, you should learn a bit about various technologies and APIs for connecting with a database.
The more traditional method is ADO.NET, which allows you to define connections and execute SQL queries or stored procedures very easily. I recommend digging up a basic tutorial on ADO.NET using Google, which may differ depending on what type of project you're creating (web app, console, WinForms, etc).
Now days, ORMs are becoming increasingly popular. They allow you to define your object model in code (such as every database table would be a class, and columns would be properties on that class) and bind to an existing database. To add a new row to a table, you'd just create an instance of a class and call a "Save" method when you're done.
The .NET framework has LINQ to SQL and the Entity Framework for this sort of pattern, both of which have plenty of tutorials online. An open source project I really like is Castle Active Record, which is built on top of NHibernate. It makes defining ORMs quite easy.
If you have specific questions about any of the above, don't hesitate to post a new question with more specific inquiries. Good luck!
Update:
I thought I'd also put in one last reference as it seems you might be interested in working with local database stores rather than building a client/server app. SQLite allows you to interact with local stores on the file system through SQL code. There's also a .NET binding maintained by the SQLite guys (which would in theory allow you to work with the other platforms I mentioned): http://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki
Related Topics
Show Authentication Dialog in C# for Windows Vista/7
Datetime's Representation in Milliseconds
Publish a Project with Local Database
Are Timers and Loops in .Net Accurate
C# - How to Detect a Windows Shutdown/Logoff and Cancel That Action (After Asking the User)
Topmost Form, Clicking "Through" Possible
No Itemchecked Event in a Checkedlistbox
Google Maps V3 Geocoding Server-Side
Using Folderbrowserdialog in Wpf Application
How to Scroll to Element in Uwp
Creating a Database Programmatically in SQL Server
Any Trick to Use Opacity on a Panel in Visual Studio Window Form