本文介绍了区分大小写比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在尝试比较两段文字。如果案例不同,我希望 它与文本不同的情况相同。我试过做一个二元的比较,但是它不起作用。 有人有什么建议吗?我的代码如下。 感谢高级, Elena 选项比较二进制 导入System.Data.OleDb 公共类CDRLValidation 继承System.Windows.Forms.Form Dim strsql作为字符串 ''用于调试的连接 Public Shared conStr As String =" Provider = Microsoft.JET.OLEDB.4.0; data source = C:\ CDRL.mdb" ''创建连接对象 Public Shared conn As OleDbConnection = New OleDbConnection(conStr) Private Sub CDRLValidation_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)处理MyBase.Load 调用Clearform() End Sub Private Sub Clearform() TextBox1.Text ="" TextBox2.Text ="" ''密码字符是星号。 TextBox2.PasswordChar =" *" End Sub Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理Button1.Click strsql = 从登录中选择*,其中user_name =''" &安培; TextBox1.Text & "''和user_pass =''" &安培; TextBox2.Text& "''" Debug.Write(strsql) Dim cmd1 As New OleDbCommand(strsql,conn) conn.Open( ) Dim daUser As New OleDbDataAdapter(cmd1) Dim dsUser As New DataSet daUser.Fill(dsUser," Login") conn.Close() Dim intCount As Integer = dsUser.Tables(0).Rows.Count 如果intCount = 0然后 MsgBox(用户名/密码不存在。请再试一次。) 呼叫Clearform() 结束如果 如果intCount = 1那么 Dim strChange As String = dsUser.Tables(0).Rows(0)(" user_pass")。ToString 如果strChange =" userPass" = True然后 Debug.Write(strChange) Dim ChangePrompt作为新的ChangePrompt ChangePrompt.ShowDialog() Else Dim CDRLSelect As New CDRLSelect CDRLSelect.ShowDialog() 结束如果 结束如果 End Sub 结束班I''m trying to compare two pieces of text. If the cases are different, I wantit to be the same as if the text were different. I tried doing a binarycompare, but it''s not working.Does anyone have any suggestions? My code is below.Thanks in Advanced,ElenaOption Compare BinaryImports System.Data.OleDbPublic Class CDRLValidationInherits System.Windows.Forms.FormDim strsql As String''connection for debuggingPublic Shared conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;datasource=C:\CDRL.mdb"'' Create connection objectPublic Shared conn As OleDbConnection = New OleDbConnection(conStr)Private Sub CDRLValidation_Load(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles MyBase.LoadCall Clearform()End SubPrivate Sub Clearform()TextBox1.Text = ""TextBox2.Text = ""'' The password character is an asterisk.TextBox2.PasswordChar = "*"End SubPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Clickstrsql = "Select * from Login where user_name = ''" & TextBox1.Text& "'' and user_pass = ''" & TextBox2.Text & "''"Debug.Write(strsql)Dim cmd1 As New OleDbCommand(strsql, conn)conn.Open()Dim daUser As New OleDbDataAdapter(cmd1)Dim dsUser As New DataSetdaUser.Fill(dsUser, "Login")conn.Close()Dim intCount As Integer = dsUser.Tables(0).Rows.CountIf intCount = 0 ThenMsgBox("User Name/Password does not exisist. Please, try again.")Call Clearform()End IfIf intCount = 1 ThenDim strChange As String =dsUser.Tables(0).Rows(0)("user_pass").ToStringIf strChange = "userPass" = True ThenDebug.Write(strChange)Dim ChangePrompt As New ChangePromptChangePrompt.ShowDialog()ElseDim CDRLSelect As New CDRLSelectCDRLSelect.ShowDialog()End IfEnd IfEnd SubEnd Class推荐答案 我不知道你在哪里比较,我不知道变量的值是多少。所以,从这里说不可能。 ArminI have no clue where you are comparing and I can not know what the values ofthe variables are. So, it''s impossible to say from here.Armin 我不知道你在哪里比较,我不知道变量的值是什么。所以,从这里说不可能。 Armin I have no clue where you are comparing and I can not know what the values of the variables are. So, it''s impossible to say from here. Armin 我不知道你在哪里比较,我不知道变量的值是什么。所以,从这里说不可能。 Armin I have no clue where you are comparing and I can not know what the values of the variables are. So, it''s impossible to say from here. Armin 这篇关于区分大小写比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-30 03:38