To use SQLServerCE(compact edition) database in your application, you have to configure Web.config file and Global.asax file in your application as mentioned below.
Mention below connection string in Web.config file: <connectionStrings>
<add name="SqlConn" connectionString="DataSource=~\Bin\DataBaseName.sdf;password=abc;Persist Security Info=False" providerName="System.Data.SqlClient"/>
</connectionStrings>
Mention below string in script tag of Global.asax: <script runat="server">
void Application_Start(object sender, EventArgs e)
{
//Code that runs on application startup
AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
}
</script>