G
Guest
I'm trying to compare two pieces of text. If the cases are different, I want
it to be the same as if the text were different. I tried doing a binary
compare, but it's not working.
Does anyone have any suggestions? My code is below.
Thanks in Advanced,
Elena
Option Compare Binary
Imports System.Data.OleDb
Public Class CDRLValidation
Inherits System.Windows.Forms.Form
Dim strsql As String
'connection for debugging
Public Shared conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data
source=C:\CDRL.mdb"
' Create connection object
Public Shared conn As OleDbConnection = New OleDbConnection(conStr)
Private Sub CDRLValidation_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
Call Clearform()
End Sub
Private Sub Clearform()
TextBox1.Text = ""
TextBox2.Text = ""
' The password character is an asterisk.
TextBox2.PasswordChar = "*"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
strsql = "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 DataSet
daUser.Fill(dsUser, "Login")
conn.Close()
Dim intCount As Integer = dsUser.Tables(0).Rows.Count
If intCount = 0 Then
MsgBox("User Name/Password does not exisist. Please, try again.")
Call Clearform()
End If
If intCount = 1 Then
Dim strChange As String =
dsUser.Tables(0).Rows(0)("user_pass").ToString
If strChange = "userPass" = True Then
Debug.Write(strChange)
Dim ChangePrompt As New ChangePrompt
ChangePrompt.ShowDialog()
Else
Dim CDRLSelect As New CDRLSelect
CDRLSelect.ShowDialog()
End If
End If
End Sub
End Class
it to be the same as if the text were different. I tried doing a binary
compare, but it's not working.
Does anyone have any suggestions? My code is below.
Thanks in Advanced,
Elena
Option Compare Binary
Imports System.Data.OleDb
Public Class CDRLValidation
Inherits System.Windows.Forms.Form
Dim strsql As String
'connection for debugging
Public Shared conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data
source=C:\CDRL.mdb"
' Create connection object
Public Shared conn As OleDbConnection = New OleDbConnection(conStr)
Private Sub CDRLValidation_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
Call Clearform()
End Sub
Private Sub Clearform()
TextBox1.Text = ""
TextBox2.Text = ""
' The password character is an asterisk.
TextBox2.PasswordChar = "*"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
strsql = "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 DataSet
daUser.Fill(dsUser, "Login")
conn.Close()
Dim intCount As Integer = dsUser.Tables(0).Rows.Count
If intCount = 0 Then
MsgBox("User Name/Password does not exisist. Please, try again.")
Call Clearform()
End If
If intCount = 1 Then
Dim strChange As String =
dsUser.Tables(0).Rows(0)("user_pass").ToString
If strChange = "userPass" = True Then
Debug.Write(strChange)
Dim ChangePrompt As New ChangePrompt
ChangePrompt.ShowDialog()
Else
Dim CDRLSelect As New CDRLSelect
CDRLSelect.ShowDialog()
End If
End If
End Sub
End Class