I have a ASP.Net Web Application which connects to a SQL Server. The web.config has <connectionStrings/>. It appears web.config is not being read at runtime, and it’s causing data bound controls to fail at runtime with “The ConnectionString property has not been initialized”
My connection string uses a System DSN, and appears to follow connectionStrings Element. The DSN tests properly, and when I use the connection string from web.config on a control’s property, all works well.
EDIT: Its blowing up on the Visual Studio generated line grvSysStatus.DataBind(). Here’s the code:
<asp:GridView ID="grvSysStatus" runat="server" GridLines="None" AutoGenerateColumns="False" Width="95%" showHeader="False">
<Columns>
<asp:BoundField DataField="message_text" />
</Columns>
</asp:GridView>
Any ideas?
Thanks,
Jeff
<configuration>
<connectionStrings>
<add name="MasterTraq_Dev"
connectionString="Dsn=MasterTraq_Dev;uid=xxxxx;pwd=yyyyy;trusted_connection=No;app=Microsoft® Visual Studio® 2010;wsid=zzzzz;database=MasterTraq_Dev"
providerName="System.Data.Odbc"
/>
</connectionStrings>
...
</configuration>
That connection string looks so wrong.
I’ve not used a DSN since classic ASP days but I’m pretty sure it didn’t allow a ‘registered trademark’ character in it.
Have a look at connectionstring.com perhaps?