在web.config中添加连接字符串
2005-06-21 16:21
288 查看
web.config中的文件如下:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="constring" value="integrated security=SSPI;data source=localhost;initial catalog=教务管理系统" />
</appSettings>
<system.web>
。。。。。。。。。
</system.web>
</configuration>
访问如下:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
If Not IsPostBack Then
Dim str As String = ConfigurationSettings.AppSettings("constring")
Dim con As New SqlClient.SqlConnection(str)
da.SelectCommand.Connection = con
da.Fill(daset, "课程信息")
dagrid.DataSource = daset.Tables("课程信息")
dagrid.DataBind()
End If
End Sub
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="constring" value="integrated security=SSPI;data source=localhost;initial catalog=教务管理系统" />
</appSettings>
<system.web>
。。。。。。。。。
</system.web>
</configuration>
访问如下:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
If Not IsPostBack Then
Dim str As String = ConfigurationSettings.AppSettings("constring")
Dim con As New SqlClient.SqlConnection(str)
da.SelectCommand.Connection = con
da.Fill(daset, "课程信息")
dagrid.DataSource = daset.Tables("课程信息")
dagrid.DataBind()
End If
End Sub
相关文章推荐
- .net下在Web.Config文件中添加连接字符串
- 在web.config中添加连接字符串
- 在web.config中如何配置数据库连接字符串,较为安全?
- C#获取web.config连接数据库字符串
- asp.net 获取web.config中的连接字符串
- Web.config配置连接数据库字符串的方法
- web.config connectionStrings 数据库连接字符串的解释(转载)
- web.config中的连接字符串
- 获取WEB.config的数据库连接字符串
- 对web.config的数据库连接字符串进行加密
- 关于在web.config中配置连接字符串及其使用
- 不同数据库下的web.config中数据库连接字符串
- Winform添加App.config文件和调用连接字符串的两种写法
- 利用ASP.NET加密和解密Web.config中连接字符串
- 【ASP.NET】--web.config中的连接字符串
- Web.Config和Sql Server2005连接字符串总结(转)
- 在web.config中配置数据库连接字符串
- web.config 保存(Access)数据库连接字符串的两种方法
- ASP.NET web.config中数据库连接字符串connectionStrings节的配置
- [转]web.config保护连接字符串及其它设置信息