注册 登录
编程论坛 VB.NET论坛

求助,改错,清空连接池错误

a254298492 发布于 2008-05-06 12:38, 982 次点击
Private Sub BTRESTORE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTRESTORE.Click
        Dim strsql As String
        Dim con As SqlConnection
        Dim com As SqlCommand
        Dim databasepath As String

        Try
            con = New SqlConnection("server=localhost;database=master;uid=sa;pwd=; ")
            databasepath = TextBox1.Text & "\Backup_HMIS.bak "
            strsql = "restore   database   HMIS   from   disk= ' " & databasepath & " ' "
            com = New SqlCommand(strsql, con)
            con.Open()
            SqlConnection.ClearAllPools()
            com.ExecuteNonQuery()

            con.Close()
            MessageBox.Show("数据库还原成功!请重新启动本系统。 ", "信息提示: ", MessageBoxButtons.OK, MessageBoxIcon.Information)

        Catch ex As Exception
            MessageBox.Show(ex.Message, "错误提示: ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        Finally


        End Try

    End Sub


清空连接池。为什么ClearAllPools()不是System.Data.SqlClient.SqlConnection的成员,
0 回复
1