BUILDING A MANAGED CODE REMOTE DATABASE APPLICATION
With SQL Compact you again use the previous application. Change the filename used to have an .sdf extension, and change the read and write functions to use the database. The write function creates the database file if it doesn’t already exist, so there is no need to create the file in preparation.
1. Create a database on a SQL server called MyMusic.
2. Set it so that a specific user can access the database.
3. Make sure the SQL server permits remote access over TCPIP.
4. Determine the connection string for that user to the database on that server. An example follows:
private string connectionString = “Data Source=myserver;Initial Catalog= MyMusic;Integrated Security=Integrated;User ID=myserver\user1;Password=pwd";
Code snippet is from the project PlaylistConsole in the file sqlServerReadWrite.cs.txt
5. This would connect to the SQL server myserver, to the database MyMusic, using the credentials of user1.
6. In the project add a reference to System.Data.SqlClient.
7. Comment out the Serialization using reference and uncomment the SQL Remote using reference in the program.
Writing Fracks to a Remote SQL Server
In this function you do the following: