 <p>already you can write like this: SampledbDataContext sdc = new SampledbDataContext(Server.MapPath("~/Sampledb.mdf")); or in design.cs file public SampledbDataContext() : base(global::"[write cnn string Here !]", mappingSource) { OnCreated(); }</p>