Error : Incorrect syntax near the keyword 'FROM'. ไม่รู้ว่ามันอยู่ตรงไหนค่ะ
รบกวนผู้รู้แนะนำหน่อยค่ะ
นี่โค้ดค่ะ
Code (VB.NET)
Dim sqlSupplier As String = ""
sb = New StringBuilder()
sb.Append("SELECT * FROM Supplyer ORDER BY SupID")
sb.Append("SELECT * FROM Category ORDER BY CategoryID")
Dim sqlIni As String
sqlIni = sb.ToString()
RemoveHandler cboSupplier.SelectedValueChanged, AddressOf cboSupplier_SelectedValueChanged
RemoveHandler cboCategory.SelectedValueChanged, AddressOf cboCategory_SelectedValueChanged
com = New SqlCommand()
With com
.CommandText = sqlIni
.CommandType = CommandType.Text
.Connection = Conn
dr = .ExecuteReader()
End With
If dr.HasRows Then
Dim dtSupplier As DataTable
dtSupplier = New DataTable()
dtSupplier.Load(dr)
With cboSupplier
.BeginUpdate()
.DisplayMember = "SupName"
.ValueMember = "SupID"
.DataSource = dtSupplier
.EndUpdate()
End With
End If
If dr.HasRows Then
Dim dtCategory As DataTable
dtCategory = New DataTable()
dtCategory.Load(dr)
With cboCategory
.BeginUpdate()
.DisplayMember = "CategoryName"
.ValueMember = "CategoryID"
.DataSource = dtCategory
.EndUpdate()
End With
End If
cboSupplier.ContextMenu = New ContextMenu()
cboCategory.ContextMenu = New ContextMenu()
รบกวนช่วยหน่อยนะค่ะ
ขอบคุณค่ะ
Tag : .NET, Ms SQL Server 2008, VS 2008 (.NET 3.x)