编程论坛's Archiver

a254298492 发表于 2008-5-6 12:38

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

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的成员,

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.