且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Web配置中的连接字符串

更新时间:2022-10-22 11:27:29

这是一个例子和详情:



http://www.connectionstrings.com/Articles/Show/store-connection-string-in-web-config [ ^ ]


 <   connectionStrings  >  
< add 名称 = ConnectionStringName connectionString = 数据源= DatabaseServer;初始目录= DatabaseName;用户ID = *****;密码= ***** providerName = System.Data.SqlClient / >
< / connectionStrings >


以下是连接字符串的基本设置。

但是你想要哪个数据库要连接,它对acess / excel有一些更改

 <   connectionStrings  >  
< add name = hhcsnot connectionString = Server = database_server_ip; Initial Catalog = databasename; User ID = username;密码=你的密码 / >
< / connectionStrings >





或者你可以jus在visual studio中从服务器资源管理器拖放一个表(在这里用studio连接你的数据库),它为你自动创建一个连接字符串...



谢谢

asp.net中的数据库连接字符串 [ ^


hello to all
when i add the connection string to web config
have error
when i add the statements
connectionStrings
add name="CS" connectionString="server=192.168.3.34;database=TMTDB;uid=sa;pwd=123"/
/connectionStrings

and can you show me the web config after add this statements

Here is the example and details:

http://www.connectionstrings.com/Articles/Show/store-connection-string-in-web-config[^]


<connectionStrings>
  <add name="ConnectionStringName" connectionString="Data Source=DatabaseServer;Initial Catalog=DatabaseName;User ID=*****;Password=*****" providerName="System.Data.SqlClient"/>
</connectionStrings>


Below is the basic setting for connection string.
But which database you want to connect, it have some changes for acess/excel
<connectionStrings>
<add name="hhcsnot"  connectionString="Server=database_server_ip;Initial Catalog=databasename;User ID=username;Password=yourpassword"/>
</connectionStrings>



or you can just drag and drop a table from server explorer(connect your database here with studio) in visual studio, It creates automatic a connection string for you...

Thanks
Database Connection String in asp.net[^]