#眉標=SQL Server 2005 #副標=SQL Server 2005練功房(4) #大標=體驗ADO.NET 2.0 存取SQL Server 2005新功能 #作者=文/楊志強 ===========程式=========== 程式1 Dim cnn as SqlConnection=New SqlConnection (“連結字串”) Cnn.Open() Dim cmd as SqlCommand=New SqlCommand (“查詢自串”,cnn) Dim dr as SqlDataReader=cmd.ExecuteReader Using bcp as SqlBulkCopy = New SqlBulkCopy (“連結字串”) bcp.DestinationTableName =”目的資料表” bcp.WriteToServer(dr) End Using ===========程式=========== ===========程式=========== <%@ OutputCache SqlDependency="CommandNotification" Duration="10000" VaryByParam="None" %> ===========程式=========== ===========程式=========== 程式2 '更改密碼使用連結字串搭配新密碼 SqlConnection.ChangePassword("User ID=" + SQL 帳號 + ";Password=" + 舊密碼 + "; Data Source=" + 伺服器 , 新密碼) '重新連結資料庫 conn.ConnectionString = "User ID=" + SQL 帳號 + ";Password=" + 新密碼 + ";Data Source=" + 伺服器 '再一次開啟連結 conn.Open ===========程式===========