In This VB.Net Tutorial We Will See How to use Khmer font Unicode Query in MSSQL Server Using VB.net
Please watch the video below:
Requirement: You need create connection to database
Source Code:
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
CheckConectionState()
Dim DT As New DataTable
Dim DA As New OleDb.OleDbDataAdapter
Dim SQL As String
SQL = "SELECT * FROM tbl_profile WHERE Name LIKE N'%" & txtSearch.Text & "%'"
DA = New OleDb.OleDbDataAdapter(SQL, CNN)
DA.Fill(DT)
If DT.Rows.Count <= 0 Then
MsgBox("No data in database")
txtId.Text = ""
txtName.Text = ""
txtSex.Text = ""
txtAddress.Text = ""
txtPhone.Text = ""
Else
txtId.Text = DT.Rows(0).Item(0).ToString
txtName.Text = DT.Rows(0).Item(1).ToString
txtSex.Text = DT.Rows(0).Item(2).ToString
txtAddress.Text = DT.Rows(0).Item(3).ToString
txtPhone.Text = DT.Rows(0).Item(4).ToString
End If
End Sub
0 Comments