1.可能是服务器资源紧缺,先关掉其它进程!
2.可能是你的程序设计不合理,先前连接未关闭掉吧!connctiontimeout参数设大点
Public Sub open_cn()
Try
cnstr = "server=server; database=htkdb; uid=sa; pwd=hai;" 'server是服务器名
'cnstr = "server=manage; database=htkdb; uid=sa; pwd=hai;" 'manage是本地主机名
If cn Is Nothing Then
cn = New SqlConnection(cnstr)
End If If cn.State = ConnectionState.Closed Then
cn.ConnectionString = cnstr
cn.Open()
End If
Catch ex As Exception
MessageBox.Show(ex.ToString, "Error")
End Try
End Sub