I know that this is well-covered ground, but for some reason I have been unable to get this database connection working. This is my first project using .net systems instead of PHP/MySQL so I'm not quite sure how things are working. I've spent the morning trying different connection strings and running through tutorials and I'm finally posting here in the hope that someone can kick me in the right direction : )
The connection code I have is:
SqlConnection myConnection = null;
try
{
myConnection = new SqlConnection(@"Data Source=C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Samples\Northwind.sdf;Persist Security Info=True");
}
catch (Exception e)
{
Console.WriteLine("Error during database connection: "+e.ToString());
}
try
{
myConnection.Open();
}
catch (Exception e)
{
Console.WriteLine("Error opening database connection: "+e.ToString());
}
This always fails at .open();