在ASP.NET中设置连接字符串到SQL Server [英] Setting up connection string in ASP.NET to SQL SERVER

查看:139
本文介绍了在ASP.NET中设置连接字符串到SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的web.config文件(Visual Studio 2008中/ ASP.NET 3.5),以建立一个连接字符串到本地服务器(SQL Server 2008中)。

I'm trying to set up a connecting string in my web.config file (Visual Studio 2008/ASP.NET 3.5) to a local server (SQL server 2008).

在我的web.config,如何以及在哪里我把连接字符串?

In my web.config, how and where do I place the connection string?

推荐答案

您也可以使用此,这是更简单。唯一觉得你需要设置的是YourDataBaseName

You can also use this, that is more simple. The only think that you need to set is the YourDataBaseName

  <connectionStrings>
    <add name="ConnStringDb1" connectionString="Data Source=localhost;Initial Catalog=YourDataBaseName;Integrated Security=True;" providerName="System.Data.SqlClient" />
  </connectionStrings>

这篇关于在ASP.NET中设置连接字符串到SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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