Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
All-Star
118619 Points
18779 Posts
Nov 29, 2011 12:46 AM|LINK
eric.silva I am trying to connect to my Access Database. Is this the correct way my "web.config" should be setup? The error is " Unrecognized element." and it is referent to Line 1 "<configuration>" All help is appreciated. Thank You. <configuration> ConnectionString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="d:\DZHosts\LocalUser\thesilvagroup\tsgits.somee.com\database\itss.mdb") Set DbConnection = Server.CreateObject("ADODB.Connection") DbConnection.Open ConnectionString <system.web> <customErrors mode="Off"/> </system.web> </configuration>
I am trying to connect to my Access Database. Is this the correct way my "web.config" should be setup? The error is " Unrecognized element." and it is referent to Line 1 "<configuration>" All help is appreciated. Thank You.
<configuration> ConnectionString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="d:\DZHosts\LocalUser\thesilvagroup\tsgits.somee.com\database\itss.mdb") Set DbConnection = Server.CreateObject("ADODB.Connection") DbConnection.Open ConnectionString <system.web> <customErrors mode="Off"/> </system.web> </configuration>
Sorry you are definately wrong。 You CANNOT write any C# or Visual Basic codes there。
You should do something like this following in the web.config:Here's a full complete xml contents,and you can refer to the bold one:
<?xml version="1.0" encoding="utf-8"?> <configuration> <connectionStrings> <add name="Your Connection Name here" connectionString="Your connection string here" /> </connectionStrings> <system.web> <compilation debug="true" targetFramework="4.0"> <assemblies> <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </assemblies> </compilation> </system.web> <system.webServer> <defaultDocument> <files> <add value="WebForm1.aspx" /> </files> </defaultDocument> </system.webServer> </configuration>
For more about Access's db connection string, please have a look at this Connection String Searching web site at:
http://www.connectionstrings.com/
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Configuration Error
Nov 29, 2011 12:46 AM|LINK
Sorry you are definately wrong。 You CANNOT write any C# or Visual Basic codes there。
You should do something like this following in the web.config:Here's a full complete xml contents,and you can refer to the bold one:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="Your Connection Name here" connectionString="Your connection string here" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
</system.web>
<system.webServer>
<defaultDocument>
<files>
<add value="WebForm1.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
For more about Access's db connection string, please have a look at this Connection String Searching web site at:
http://www.connectionstrings.com/