编辑连接字符串 将数据库备份到服务器数据库后
我对此还是新手:$
我已完成以下操作:
- 我已将数据库发布到我的磁盘上。
- 使用 microsoft sql server management studio 2008 打开已发布的脚本“DB.MDF”。
- 执行它并备份。它位于系统数据库下的主数据库中。
- 在服务器上,我创建了一个同名的新用户和新数据库。
- 我确实恢复了 DB.BAK 并浏览了数据库,然后找到了我的表。
现在我需要编辑连接字符串..这是配置文件中的连接字符串:
<add name="AlBayanEntities" connectionString="metadata=res://*/Core.Model.AlBayan.csdl|res://*/Core.Model.AlBayan.ssdl|res://*/Core.Model.AlBayan.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\AlBayan.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
我已将其更改为:
<add name="AlBayanEntities" connectionString="Server=;Database=databaseName;Uid=bayan;Password=1abcd;" providerName="System.Data.EntityClient" />
并且我的主机计划是这样的:
'您还可以在应用程序连接字符串中使用上面的 SQL Server 地址,例如:ASP.NET (ADO.NET Library) Server=;Database=databaseName;Uid=userName;Password=password;'
我做得对吗?
因为我仍然无法登录我的网站,这意味着它不起作用,因为我已经从 ASP.NET 配置创建了一个角色,但仍然无法登录:/
I'm still new in this :$
I've done the following:
- I've published the database to my disk.
- open the published script 'DB.MDF' using microsoft sql server management studio 2008.
- execute it and backup. it was in the master database under the System database.
- on the server, I have created a new user and new database with the same name.
- I did restore the DB.BAK and browser the database and I found my tables.
now I need to edit the connection string.. this is my connection sting from the config file:
<add name="AlBayanEntities" connectionString="metadata=res://*/Core.Model.AlBayan.csdl|res://*/Core.Model.AlBayan.ssdl|res://*/Core.Model.AlBayan.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\AlBayan.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
I've changed it to:
<add name="AlBayanEntities" connectionString="Server=;Database=databaseName;Uid=bayan;Password=1abcd;" providerName="System.Data.EntityClient" />
and I got on my host plan this:
'You may also use SQL Server address above in your application connection strings, for example: ASP.NET (ADO.NET Library) Server=;Database=databaseName;Uid=userName;Password=password;'
am I doing right?
coz I still can't login to my website which means it didn't work because I have created a role from the ASP.NET configuration and still can't log in :/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您的示例连接字符串中,
Database=databaseName
是“databaseName”您数据库的实际名称吗?必须如此。
In your example connection string you have
Database=databaseName
is "databaseName" the actual name of your database? It needs to be.
ASP.NET 成员资格对于新手来说通常很难配置。我强烈建议您先创建一个简单的页面,然后尝试从数据库中获取一些记录,看看您的连接字符串是否正确。如果正常,则继续执行后续故障排除步骤。
ASP.NET membership is usually hard for newbies to configure. I strongly suggest that you create a simple page first, and try to fetch few records from database to see if your connection string is right. If it's OK, then move to next troubleshooting steps.