รอกวนด้วยครับ มีปัญหาอยุ่ว่า ทำยังไงก็ Search id กับ Search name มันขึ้นต่อกัน เวลาที่เรา Search ใน Search name [EN]อ่าครับ
Code (VB.NET)
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim use As String
Dim passs As String
use = Class1.uss
passs = Class1.pass
Label5.Text = TextBox1.Text
Dim connectionString As String = "Server=N-PC;UID=" & use & ";PASSWORD=" & passs & ";Database=Top_CustomerEntry;Connect Timeout=200; pooling='true'; Max Pool Size=200"
Dim st As String = "Select NameEn from Employee1 WHERE NameEn = " & Label5.Text & ""
SerachGrid("select * from Employee1 where NameEn like '%" & TextBox1.Text & "%'")
Dim connection As New SqlConnection(connectionString)
Dim da As New SqlDataAdapter(st, connection) 'Connection
Dim ds As New DataSet
connection.Open()
Try
da.Fill(ds, "NameEn")
ComboBox1.Text = ds.Tables("NameEn").Rows(0).Item("IDEmp").ToString
Catch ex As Exception
'Label5.Text = ComboBox1.Text
End Try
connection.Close()
'Class1.IDD = ComboBox1.Text
' SerachGrid("select * from Employee1 where NameEn like '%" & TextBox1.Text & "%'")
End Sub
Public Sub ClearTextBoxes(ByVal frm As Form)
For Each Control In frm.Controls
If TypeOf Control Is TextBox Then
Control.text = "" 'Clear all text
End If
Next Control
End Sub
ขอบคุณครับ ^^
Tag : .NET, Ms Access, Ms SQL Server 2008, VB.NET, VS 2008 (.NET 3.x), VS 2010 (.NET 4.x)