如何在Web Config(VS2010 Ultimate)中添加连接字符串 [英] How to add Connection String in Web Config (VS2010 Ultimate)

查看:72
本文介绍了如何在Web Config(VS2010 Ultimate)中添加连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的所有专家,

Dear All Experts,

    <add name="conString">

      connectionString="Data Source=.\SQLEXPRESS;

                        database=Northwind;Integrated Security=true"/>



</add>



但是能够连接我的数据库.接下来我要做什么

感谢您的宝贵重放.



But anable to connect my databse. What i will do next

Thank u for ur valuable replay

推荐答案

如果您通过Visual Studio连接到数据库(使用服务器资源管理器)并突出显示数据库,则属性"窗格将保留完整的和有效的连接字符串,您可以将其复制并粘贴到web.config

如果您尝试连接到Web主机上的数据库而不是用于测试的开发机器,则需要查看Web主机常见问题解答:信息将在那里,或者在您签名后发送给您的电子邮件中
If you connect to your database via Visual Studio (use the Server Explorer) and highlight the database, the Properties pane will hold the complete and working connection string which you can copy and paste into your web.config

If you are trying to connect to a database on your web host instead of the development machine you used for testing, then you need to look at your web hosts FAQ: the information will be there, or in an email sent to you when you signed up.


首先通过右键单击解决方案资源管理器添加新项目,然后选择应用程序配置文件"

然后输入此代码
first add new item by right click on solution explorer then select Application Configuration File

and type this code
<configuration>
    <configsections>
    </configsections>
    <connectionstrings>
        <add name="AccountingWindowApplication.Properties.Settings.WinPhoneAppConnectionString">
            connectionString="Data Source=COMPAQ-PC\SQLEXPRESS;Initial Catalog=WinPhoneApp;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </add></connectionstrings>
</configuration>


这篇关于如何在Web Config(VS2010 Ultimate)中添加连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆