ปรากฏว่า มัน orrer ตรง dr = .ExecuteReader() ว่า " Characters found after end of SQL statement. " ผมก้อเลยเก็บคำสั่ง sql ใน sqlsel แค่ตารางเดียว และ combobox แค่อันเดียว
Private Sub frmplease_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Maximized
Dim fd As New fader
fd.FadeIn(Me, 0.25)
sw.Reset()
sw.Start()
Dim strConn As String
strConn = DBConnString.strConn
Conn = New OleDbConnection()
With Conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = strConn
.Open()
End With
sb = New StringBuilder()
sb.Append("SELECT * FROM tb_respon;")
sb.Append("SELECT * FROM tbstatus;")
sb.Append("SELECT * FROM tbchance;")
sb.Append("SELECT * FROM tbanorder;")
Dim sqlsel As String
sqlsel = sb.ToString()
Com = New OleDbCommand()
With Com
.CommandText = sqlsel
.CommandType = CommandType.Text
.Connection = Conn
dr = .ExecuteReader()
End With
If dr.HasRows Then
dtanorder = New DataTable()
dtanorder.Load(dr)
With cb_order
.BeginUpdate()
.DisplayMember = "name_anorder"
.ValueMember = "id_anorder"
.DataSource = dtanorder
.EndUpdate()
End With
dtchance = New DataTable()
dtchance.Load(dr)
With cb_chance
.BeginUpdate()
.DisplayMember = "name_chance"
.ValueMember = "id_chance"
.DataSource = dtchance
.EndUpdate()
End With
dtstatus = New DataTable()
dtstatus.Load(dr)
With cb_st
.BeginUpdate()
.DisplayMember = "name_status"
.ValueMember = "id_status"
.DataSource = dtstatus
.EndUpdate()
End With
dtrespon = New DataTable()
dtrespon.Load(dr)
With cb_rsp
.BeginUpdate()
.DisplayMember = "name_rpn"
.ValueMember = "id_rpn"
.DataSource = dtrespon
.EndUpdate()
End With
End If
dr.Close()
sw.Stop()
processtime = sw.ElapsedMilliseconds / 1000
_toolstriplabel.Text = "เวลาที่ใช้ : " & processtime.ToString("0.0000") & " วินาที"
End Sub
strSQL = "SELECT * FROM tb_respon"
dt.Clear()
da = New SqlDataAdapter(strSQL, conn)
da.Fill(dt)
If dt.Rows.Count <> 0 Then
With ComboBox
.BeginUpdate()
.DisplayMember = "name"
.ValueMember = "id"
.DataSource = dt
.EndUpdate()
End With