你的Config应该有点问题
给你一个例子
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="ApplicationConfiguration" type="Duwamish7.SystemFramework.ApplicationConfiguration, Duwamish7.SystemFramework" />
    <section name="DuwamishConfiguration" type="Duwamish7.Common.DuwamishConfiguration, Duwamish7.Common" />
    <section name="SourceViewer" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <system.web>
    <customErrors defaultRedirect="errorpage.aspx" mode="On" />
    <compilation debug="true" />
    <!-- The sessionState is currently set to inproc:  the lines following [mode="inproc"] are not used but are present for ease of configuration -->
    <sessionState cookieless="false" timeout="20" mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" />
    <globalization responseEncoding="utf-8" requestEncoding="utf-8" />
    <!-- security -->
    <authentication mode="Forms">
      <forms name=".ADUAUTH" loginUrl="secure\logon.aspx" protection="All">
      </forms>
    </authentication>
    <authorization>
      <allow users="*" />
    </authorization>
  </system.web>
  <ApplicationConfiguration>
    <!-- Trace file settings -->
    <add key="SystemFramework.Tracing.Enabled" value="False" />
    <!-- Set this to the file with the trace settings. This file should be relative
             to the root application directory. -->
    <add key="SystemFramework.Tracing.TraceFile" value="DuwamishTrace.txt" />
    <!-- The TraceLevel for this switch.  -->
    <add key="SystemFramework.Tracing.TraceLevel" value="4" />
    <!-- This switch name. The trace level for this name can be set through
             environment variables or the registry  -->
    <add key="SystemFramework.Tracing.SwitchName" value="DuwamishTraceSwitch" />
    <!-- This description of the Tracing.SwitchName switch -->
    <add key="SystemFramework.Tracing.SwitchDescription" value="Error and information tracing for Duwamish" />
    <!-- Event log settings
Note: The default Duwamish7 event source name is created in the local machine during setup. If you wish to log events to a different event source
              that event source must exist.
        -->
    <add key="SystemFramework.EventLog.Enabled" value="True" />
    <add key="SystemFramework.EventLog.Machine" value="." />
    <add key="SystemFramework.EventLog.SourceName" value="Duwamish7" />
    <!-- Use the standard TraceLevel values:
             0 = Off
             1 = Error
             2 = Warning
             3 = Info
             4 = Verbose -->
    <add key="SystemFramework.EventLog.LogLevel" value="1" />
  </ApplicationConfiguration>
  <DuwamishConfiguration>
    <!-- Settings specific to the Duwamish application -->
    <add key="Duwamish.DataAccess.ConnectionString" value="server=DRAGONTT;User ID=Duwamish7_login;Password=password;database=Duwamish7;Connection Reset=FALSE" />
    <add key="Duwamish.Web.EnablePageCache" value="True" />
    <add key="Duwamish.Web.PageCacheExpiresInSeconds" value="3600" />
    <add key="Duwamish.Web.EnableSsl" value="False" />
  </DuwamishConfiguration>
  <SourceViewer>
    <!-- Valid directories for source browsing. Keep these lower case. -->
    <add key="." value=" " />
    <add key="modules" value=" " />
    <add key="..\common\data" value=" " />
    <add key="..\systemframework" value=" " />
    <add key="..\business\facade" value=" " />
    <add key="..\business\rules" value=" " />
    <add key="..\dataaccess" value=" " />
    <add key="secure" value=" " />
    <add key="docs\common" value=" " />
    <add key="docs\dataaccess" value=" " />
    <add key="docs\facade" value=" " />
    <add key="docs\rules" value=" " />
    <add key="docs\web" value=" " />
  </SourceViewer>
</configuration>

解决方案 »

  1.   

    这是vs.net中直带的Duwamish的Web.config
      

  2.   

    你确信这样能连接你的数据库吗?server=myserver;database=f2000;trusted_connection=false;user id=sa
      

  3.   

    dim ConnectionString as string = ConfigurationSettings.AppSettings["myconnectionstring"]
    后面的方括号应该是C#的用法,VB应该是圆括号,改成这样试试:
    dim ConnectionString as string = ConfigurationSettings.AppSettings("myconnectionstring")
      

  4.   

    改为圆括号,就提示:ConnectionString 属性尚未初始化,让人费解!!!!
      

  5.   

    数据库连接没有问题,原来还是在页面中使用,本来想弄到web.config中去为以后维护提供方便,没想到开始就碰钉子了。
      

  6.   

    你的ConnectionString是字符串,而你把它当作数据库连接用了,你应该另处声明一个数据库连接,象这样:
    dim conn as SqlConnection=new SqlConnection(ConnectionString)
      

  7.   

    问题:connectionstring尚未初始化是出现在
    dim mysql as new sqlconnection(connectionstring)
    ...
    mysql.open()的时候。可见connectionstring 在调用webconfig中没有获得字串。不知我的分析是否正确?
      

  8.   

    这是我正在使用的一个连接的例子.     <appSettings>
            <add key="ConnString" value="data source=DATASRV;initial catalog=jsmis;password=jsmis;persist security info=True;user id=jsmis;workstation id=DATASRV;packet size=4096" /> 
        </appSettings>
    一定要放到<configuration>和<system.web>之间读取这个连接:
     SqlCnStr = ConfigurationSettings.AppSettings("ConnString")
      

  9.   

    很愚昧的问题。我居然将<appSettings>放在了<!-- -->之间。多谢各位!结帖了!