Monday, July 27, 2009

Connection String for ASP.NET C# web.config file?

Hi I am creating a connection to an ms access database in ASP.NET via web.config. The file is under the App_Data folder. Can someone help me with the connection string? Thanks....

Connection String for ASP.NET C# web.config file?
I have never worked with Access however I believe the following ConnectionString should work





Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Server.MapPath(" ~/App_Data/ ASPNetDB.mdb ")





That is to say in your web.config you should have something like:





%26lt;connectionStrings%26gt;


%26lt;remove name = "AccessFileName"/%26gt;


%26lt;add name="AccessFileName" connectionString = " ~/App_Data/ASPNetDB.mdb " providerName = "System.Data.OleDb"/%26gt;


%26lt;/connectionStrings%26gt;





Hope this helps
Reply:this should help you out:





http://msdn2.microsoft.com/en-us/library...

tarot cards

No comments:

Post a Comment