How to use .mdf database in our Application using C#
Hi Friend,
we can use .mfd as a database in our application by using connectionstring in web config having a details of .mdf database .like this.
If you want to get the login User Details through Membership table in .mdf file you can use this code:
this will give you the Datails of login User ..
Thanks & Regards
Rajesh
we can use .mfd as a database in our application by using connectionstring in web config having a details of .mdf database .like this.
<add name="ConnectionString" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|ASPNETDB.MDF;User Instance=true" providerName="System.Data.SqlClient"/>
If you want to get the login User Details through Membership table in .mdf file you can use this code:
using System.Web.Security;
MembershipUser objUserID = Membership.GetUser();
string sUserID = objUserID.ProviderUserKey.ToString();
this will give you the Datails of login User ..
Thanks & Regards
Rajesh
0 comments: