我认为如果我可以计算出一生的符号,这可能会有效,我错了吗?
Try
'Setup Connection String
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " & Application.StartupPath & "\igcDatabase.accdb"
sqlCom.Connection = conn
'Open Data Connection
conn.Open()
If rbMemberID.Checked = True Then
'Query
sqlCom.CommandText = "SELECT * FROM [Members] WHERE [Member ID] = @MemberID"
'Parameter is used below to prevent SQL Injection
sqlCom.Parameters.AddWithValue("MemberID", txtSearchInput.Text)
Else
MessageBox.Show("If you are not getting the result you wanted, try again with Member ID.", "", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Query
sqlCom.CommandText = "SELECT * FROM [Members] WHERE [Member First Name] = @FirstName"
'Parameter is used below to prevent SQL Injection
sqlCom.Parameters.AddWithValue("FirstName", txtSearchInput.Text)
End If
Dim sqlRead As OleDbDataReader = sqlCom.ExecuteReader()
sqlRead.Read()
If sqlRead.HasRows = True Then
Dim membershipType As String
If sqlRead.GetValue(4) = 1 Then
membershipType = "Deluxe"
ElseIf sqlRead.GetValue(4) = 2 Then
membershipType = "Non-Deluxe"
Else
membershipType = "Week-Day"
End If
txtMemberID.Text = sqlRead.GetValue(0)
txtFirstName.Text = sqlRead.GetString(1)
txtLastName.Text = sqlRead.GetString(2)
txtGender.Text = sqlRead.GetString(3)
txtContact.Text = sqlRead.GetValue(5)
txtEmail.Text = sqlRead.GetString(6)
txtMembershipType.Text = membershipType
txtEntyDate.Text = sqlRead.GetDateTime(7)
txtStatus.Text = sqlRead.GetString(8)
Else
MessageBox.Show("There Is no such member found in database. Please Try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning)
txtMemberID.Clear()
txtFirstName.Clear()
txtLastName.Clear()
txtGender.Clear()
txtContact.Clear()
txtEmail.Clear()
txtMembershipType.Clear()
txtStatus.Clear()
txtEntyDate.Clear()
txtSearchInput.Clear()
txtSearchInput.Select()
End If
sqlCom.Parameters.Clear()
sqlRead.Close()
conn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
答案 0 :(得分:4)
匹配只适用于具体类型,所以答案是否定的。除了我们可以在其上调用T
中定义的方法(用于在字符串中搜索)之外,对此类型Pattern
一无所知。