问题描述
ImportsSystem.DataImportsSystem.Data.OleDbPublicClassLoginFrmDimConnAsOleDb.OleDbConnectionDimCmdAsOleDb.OleDbCommandDimRdAsOleDb.OleDbDataReaderDimSQLAsStringDimProvider="Provider=Microsoft.Jet.OLEDB.4.0"DimDatabase="DataSource=D:Databasemy.mdb"PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickConn=NewOleDb.OleDbConnection(Provider&";"&Database)Conn.Open()SQL="Select*From登录WhereName='"&TextBox1.Text&"'AndPassword='"&TextBox2.Text&"'"Cmd=NewOleDb.OleDbCommand(SQL,Conn)Rd=Cmd.ExecuteReader()IfRd.Read()ThenDimform2AsNewFormform2.Show()Me.Hide()ElseMessageBox.Show("密码或用户名错误!","错误提示!",MessageBoxButtons.OK,MessageBoxIcon.Error)TextBox1.Text=""TextBox2.Text=""TextBox1.Focus()EndIfRd.Close()Conn.Close()EndSubEndClassRd=Cmd.ExecuteReader()有错,怎么回事啊啊?
解决方案
解决方案二:
http://blog.csdn.net/machong8183/article/details/5488191
解决方案三:
用try,catch,MSGBOXEX.MESSAGE.TOSTRING