 |
|
ช่วยด้วยครับ ทำไม Textbox แสดงข้อมูลตาม Combobox เมื่อเลือกแล้วมันเกิดปัญหา อ่าครับ "มีรูป" |
|
 |
|
|
 |
 |
|
จาก Error คือยังไมไ่ด้เชื่อมต่อกับ Database น่ะครับ ลองดูพวก Scope ของตัวแปร ว่ามีผลเฉพาะใน Sub หรือว่าทั้ง Class 
|
 |
 |
 |
 |
Date :
2014-07-28 14:12:44 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พอผมลบ Fill Team กับ Fill ZuelligArea เลื่อนได้เฉยเลยครับ งงมาก ๆ TT
Code (VB.NET)
Dim use As String
Dim passs As String
use = Class1.uss
passs = Class1.pass
' SerachGrid("select * from AreaMaster where Area 'txtarea.Text' ")
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 AreaID,Area,Team,ZuelligArea FROM AreaMaster Where AreaID = '" & ComboBox1.Text & "'"
' Me.txtarea.Text = Me.ComboBox1.SelectedItem("Area")
'Me.txtteam.Text = Me.ComboBox1.SelectedItem("Team")
'Me.txtzuellig.Text = Me.ComboBox1.SelectedItem("ZuelligArea")
'Dim strID As String = Me.DataGridView1(0, Me.DataGridView1.CurrentCell.RowIndex).Value.ToString()
'Dim myConnection As SqlConnection
'myConnection = New SqlCeConnection("Data Source =" + (System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase ) + "\Database1.sdf;"))
' myConnection.Open()
' Dim myCommand As SqlCommand = myConnection.CreateCommand()
connection.Open()
'sTable = sDs.Tables("Area")
'ComboBox1.ValueMember = "AreaID"
' ComboBox1.DisplayMember = "AreaID"
'ComboBox1.Text = ComboBox1.SelectedValue
'If sDs.Tables("AreaID").Rows.Count <> 0 Then
ComboBox1.ValueMember = "Area"
ComboBox1.DisplayMember = "AreaID"
txtarea.Text = ComboBox1.SelectedValue
'End If
'sDs = New DataSet()
ComboBox1.Refresh()
'sAdapter.Fill(sDs, "AreaID")
'sTable = sDs.Tables("Area")
'txtarea.Text = ComboBox1.SelectedValue.ToString()
'txtteam.Text = ComboBox1.SelectedValue.ToString()
'txtzuellig.Text = ComboBox1.SelectedValue.ToString()
'sCommand = New SqlCommand(sql, connection)
's Adapter = New SqlDataAdapter(sCommand)
'sBuilder = New SqlCommandBuilder(sAdapter)
'sDs = New DataSet()
SerachGrid("select * from AreaMaster where AreaID like '%" & ComboBox1.Text & "%'")
connection.Close()
|
 |
 |
 |
 |
Date :
2014-07-28 16:46:06 |
By :
heloman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|