0
當我在第一個文本框寫的字(大小)VB.NET使用行部分匹配
我的字典裏從訪問數據庫應用該行:
和寫入(大型大-huge)在第二個文本框
但我試圖做相反的事情,例如
和程序給予搜索(大)在第二個文本框
,但我必須寫S(尺寸)(大大巨)應用上一行
我如何可以使用部分匹配與被標註爲數據庫( - )?
代碼的功能的:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = argetword(TextBox1.Text)
其他信息:
編輯的代碼:
Function argetword(ByVal content As String) As String
Try
Using adp As New OleDb.OleDbDataAdapter("SELECT English FROM [Words] WHERE Arabic LIKE '%" & content & "%'", connectionString)
Using tbl As New DataTable
If adp.Fill(tbl) > 0 Then
For Each row As DataRow In tbl.Rows
content = System.Text.RegularExpressions.Regex.Replace(content, row.Item("Arabic"), row.Item("English"), System.Text.RegularExpressions.RegexOptions.IgnoreCase)
Next
End If
End Using
End Using
Return content
Catch ex As Exception
MsgBox(ex.Message)
Return String.Empty
End Try
End Function
數據庫的圖象
Function argetword(ByVal content As String) As String
Try
Using adp As New OleDb.OleDbDataAdapter("SELECT * FROM [Words]", connectionString)
Using tbl As New DataTable
If adp.Fill(tbl) > 0 Then
For Each row As DataRow In tbl.Rows
content = System.Text.RegularExpressions.Regex.Replace(content, row.Item("values"), row.Item("idom"), System.Text.RegularExpressions.RegexOptions.IgnoreCase)
Next
End If
End Using
End Using
Return content
Catch ex As Exception
MsgBox(ex.Message)
Return String.Empty
End Try
End Function
翻譯按鈕的代碼:
快照的錯誤消息:
像你說的我加了一行:(「選擇IDOM從文字WHERE值LIKE「%」&含量&「%」」),但程序會彈出一個消息說:(列'Values'不屬於表格) –
對不起,也許我誤解了你的數據結構。我認爲你的專欄被稱爲價值和idom,如果情況並非如此,那麼只要用你的專欄名稱 – AaronTheRabbit
已經這樣做,這個錯誤是在那之後,我試圖改變這個短語沒有任何成功,任何建議? ??? –