新手学VB~~登录窗口错误~帮忙看看~
Dim connstr As StringDim providername1 As SqlClient.SqlConnection
connstr = "Data Source=WWW-585271DDAED;Initial Catalog=systemdate;Persist Security Info=True;User ID=sa;Password=123456"
providername1 = New System.Data.SqlClient.SqlConnection(connstr)
providername1.Open()
Dim sqlcmd As SqlClient.SqlCommand
Dim sqlcmdstr As String
sqlcmdstr = "select * form denlu where username ='" & UsernameTextBox.Text & "' and password ='" & PasswordTextBox.Text & "'"
sqlcmd = New SqlClient.SqlCommand(sqlcmdstr, providername1)
Dim rd As SqlClient.SqlDataReader
rd = sqlcmd.ExecuteReader ‘怎么提示这里错误啊~~
If rd.Read() Then
Dim form1 As New Form1
form1.Show()
Me.Hide()
Else
MessageBox.Show("帐号密码错误!", "错误提示!", MessageBoxButtons.OK, MessageBoxIcon.Error)
UsernameTextBox.Text = ""
PasswordTextBox.Text = ""
UsernameTextBox.Focus()
End If