如何在winform应用程序中放置Web主机数据库连接字符串?

时间:2015-03-31 06:27:05

标签: c# winforms web-hosting

我自己尝试了很多,但我无法找出我的下面连接字符串的问题。我已经把我的webhost连接字符串和winform连接字符串帮助了吗?

<connectionStrings> <add name="ReGdbEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;
provider=System.Data.SqlClient;
provider connection string="data source=.\SQLEXPRESS;
initial catalog=ReGdb;
integrated security=True;
MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /> </connectionStrings>

这是我的webhostdatabase connectionstring

Data Source=SQL5000322.Smarterasp.net;
Initial Catalog=DB_9BDB7789_ReGdb;
User Id=DB_9BDB7789_ReGdb_admin;
Password=happy;

2 个答案:

答案 0 :(得分:2)

嘿,你可以用这种方式修改你的连接字符串,它必须工作。只需复制并用连接字符串替换它

<connectionStrings>
<add name="ReGdbEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;
provider=System.Data.SqlClient;
provider connection tring=quot;
datasource=SQL5000322.Smarterasp.net;
initial catalog=DB_9BDB7789_ReGdb;
User Id=DB_9BDB7789_ReGdb_admin;
Password=happy;
MultipleActiveResultSets=True;
App=EntityFramework&quot;"
providerName="System.Data.EntityClient" />
</connectionStrings>

在这里,你必须工作

答案 1 :(得分:0)

注意嵌套引号:

provider connection string=&quot;data source=...