แต่ว่า ถ้าเลือกแล้ว ตัวใน text มันเป็นค่าว่าง null เมื่อไหร่ จะเกิดดังนี้อ่าครับ
รอกวนช่วยอีดครับ
Code (VB.NET)
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 connection As New SqlConnection(connectionString)
Dim sql As String = "SELECT Area,Team,ZuelligArea FROM AreaMaster Where AreaID = '" & ComboBox1.Text & "'"
connection.Open()
ComboBox1.ValueMember = "Area"
ComboBox1.DisplayMember = "AreaID"
txtarea.Text = ComboBox1.SelectedValue
ComboBox1.ValueMember = "Team"
ComboBox1.DisplayMember = "AreaID"
txtteam.Text = ComboBox1.SelectedValue
ComboBox1.ValueMember = "ZuelligArea"
ComboBox1.DisplayMember = "AreaID"
txtzuellig.Text = ComboBox1.SelectedValue
'txtarea.Text = ComboBox1.SelectedValue.ToString()
'txtteam.Text = ComboBox1.SelectedValue.ToString()
'txtzuellig.Text = ComboBox1.SelectedValue.ToString()
SerachGrid("select * from AreaMaster where AreaID like '%" & ComboBox1.Text & "%'")
connection.Close()
End Sub
Tag : .NET, MySQL, Ms SQL Server 2008, VB.NET, VS 2008 (.NET 3.x), VS 2010 (.NET 4.x)