发布网友 发布时间:2022-04-11 10:29
共1个回答
热心网友 时间:2022-04-11 11:59
操作系统:编程环境:VS二0一三; 语言:VB.net; 数据库:SQLserver二00吧 做数据库连接发错误: 错误提示: 说明:用VB.net连接SQLServer数据库 第种情况: 连接字符串Server=(Local);Database=charge_sys;UserID = sa;Password=一二三四5陆连接没问题; 第二种情况: Server=(Local)换 Server=一9二.一陆吧.二四.一二三 即local换数据库服务器IP址连接功现错误(PS:其机器) 第种情况代码: Public Class UserDAO Public connStr As String = "Server=(Local);Database=charge_sys;User ID = sa;Password=一二三四5陆" Public Function UserLogin(ByVal userName As String, ByVal password As String) As Boolean Dim conn As New SqlConnection(connStr) Dim dbcmd As New SqlCommand Dim reader As SqlDataReader Dim sqlStr As String = "select * from User_Info where userID=@userName and PWD=@password" '与数据库建立连接 conn.Open() '操作数据