Dim use As String
Dim passs As String
use = Class1.uss
passs = Class1.pass
Dim connectionString As String = "Server=PONGWICS2014-PC;UID=" & use & ";PASSWORD=" & passs & ";Database=Top_CustomerEntry;Connect Timeout=200; pooling='true'; Max Pool Size=200"
Dim ds As New DataSet
Dim connection As New SqlConnection(connectionString)
Dim sql As String = "SELECT AreaID,Area,Team,ZuelligArea FROM AreaMaster Where AreaID = '" & ComboBox1.Text & "'"
If IsDBNull(ds.Tables("AreaMaster").Row(i)("txtteam.Text")) Then
Name = ""
Else
Name = ds.Tables("AreaMaster").Row(i)("txtteam.Text")
End If
ComboBox1.ValueMember = "Area"
ComboBox1.DisplayMember = "AreaID"
txtarea.Text = ComboBox1.SelectedValue
Me.txtarea.Text = sTable.Rows(0)("Area")
Me.txtteam.Text = sTable.Rows(0)("Team")
Me.txtzuellig.Text = sTable.Rows(0)("ZuelligArea")
'ComboBox1.ValueMember = "Team"
'ComboBox1.DisplayMember = "AreaID"
'txtteam.Text = ComboBox1.SelectedValue
'ComboBox1.ValueMember = "ZuelligArea"
'ComboBox1.DisplayMember = "AreaID"
' txtzuellig.Text = ComboBox1.SelectedValue
'End If
'sDs = New DataSet()
ComboBox1.Refresh()
'sAdapter.Fill(sDs, "AreaID")
'sTable = sDs.Tables("Area")
SerachGrid("select * from AreaMaster where AreaID like '%" & ComboBox1.Text & "%'")
connection.Close()
ขอบคุณมากๆๆครับปม ^^
Tag : .NET, MySQL, Ms SQL Server 2008, VB.NET, VS 2008 (.NET 3.x), VS 2010 (.NET 4.x)
Dim lstColumns() As String = ds.Tables("AreaMaster").Columns.Cast(Of DataColumn)().Select(Function(c) c.ColumnName).ToArray()
If ds.Tables("AreaMaster").Rows.Count > 0 Then
If lstColumns.Contains("txtteam.Text", StringComparer.CurrentCultureIgnoreCase) Then
'จะทำอะไรก็ว่าไปครับ
Else
MsgBox("ชื่อคอลัมภ์ไม่ถูกต้อง")
End If
End If
อธิบายเพิ่มเติม บรรทัดที่ 3 คือการเปรียบเทียบโดยไม่สนใจอักษรตัวใหญ่ตัวเล็ก เช่น A = a เป็นต้น