修改app.config文件中发布的项目连接字符串

时间:2018-01-11 21:28:41

标签: c# mysql

根据这篇文章,我了解了如何生成连接字符串并使服务器数据更容易插入app.config文件。

C# Mysql connection in txt file config

然而,我仍然面临着问题。发布项目后,使用在我开发的机器中安装基本生成的文件,在我安装的其他文件中,但是在读取数据库的信息时甚至更改文件NameOfProgram.exe.deploy仍然加载使用的服务器用于测试。 如何在发布项目后更改服务器数据? App.config中

我目前使用的文件:

  @Query(value= " select * from table_entity "
        +   " where lower(col1) = lower(:one) "
        +   " and lower(col2) = lower('001:1') "
        , nativeQuery = true)
  public List<TableEntity> findByCol1 (@Param("one") String col1);

调用字符串......:

<configuration>
 <connectionStrings>
   <add name="MyDatabaseCS"   connectionString="datasource=mysqlip;port=3306;database=winprog;username=root;password=root"/>
    </connectionStrings>
</configuration>

如何更改服务器,IP,端口,用户,密码信息没有app.config或nameOFprogram.exe.deploy? ?

0 个答案:

没有答案