求助,改错,清空连接池错误
Private Sub BTRESTORE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTRESTORE.ClickDim 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的成员,