I am trying to connect to a database without using App.Config but i keep getting the following error:
An unhandled exception of type 'System.Data.Entity.Core.EntityException' occurred in EntityFramework.dll
Additional information: The underlying provider failed on ConnectionString.
I can't see where I've gone wrong so i thought i'd ask here.
namespace MyNameSpace
{
using System;
using System.Data.Entity;
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Infrastructure;
public partial class Entities : DbContext
{
public Entities()
: base(entityString.ToString())
{
}
public static EntityConnectionStringBuilder entityString = new EntityConnectionStringBuilder()
{
Provider = "System.Data.SqlServerCe.4.0",
Metadata = "res://*/RS.csdl|res://*/RS.ssdl|res://*/RS.msl",
ProviderConnectionString = @"C:\RestOfPath\database.sdf;Password=3476dfg423434563466e85rcsd"
};
}
}
Thank you in advance for your help.