app.config 未将对象引用设置到对象实例

app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <connectionStrings>
      <clear/>
        <add name="TgNetVideo.Properties.Settings.shidevideoConnectionString"
            connectionString="server=192.168.1.121;user id=shide;password=shide;persist security info=True;database=shidevideo;port=3307"
            providerName="MySql.Data.MySqlClient" />
    </connectionStrings>
</configuration>

引用:private string CONNSTR = System.Configuration.ConfigurationManager.ConnectionStrings["TgNetVideo.Properties.Settings.shidevideoConnectionString"].ToString();
刚开始只是引用了shidevideoConnectionString。老是出现“未将对象引用设置到对象实例”错误!

你可能感兴趣的:(config)