connstr = "data source=服务器名称或者IP;initial catalog=数据库名称;user id=用户名;password=密码;persist security info=False; " MSconn = New sqlConnection(connstr) Try MSconn.Open() MsgBox("sql SERVER 2005! good") Catch ex As Exception MsgBox(ex.Message) End Try原文链接:https://www.f2er.com/vb/259311.html