I am new here and in the world of programming. What I need to do is fill a datagridview from a query that I make through a method called "DoQuery", which is inside the "SAPbobsCOM" package. I would really appreciate if someone could help me with this. I know that using sql is as simple as putting a "Fill", but they don't work the same way because I don't use a datatable or dataadapter.
Sub llenarGrillaPrueba()
Dim Count As Long
Dim i As Long
Dim RecSet As SAPbobsCOM.Recordset
RecSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
'RecSet.DoQuery("select ""ItemCode"" from OITM where ""ItemCode""='429'") 'If I only retrieve one record, the grid is loaded.
RecSet.DoQuery("select * from OITM where ""InvntItem"" = 'Y' ORDER BY ""ItemCode"" ASC") 'The problem arises when I want to show all the records.
Count = RecSet.RecordCount
MsgBox(Count)
While RecSet.EoF = False
For i = 0 To Count - 1
DataGridView1.Rows(i).Cells("codigo").Value = RecSet.Fields.Item("ItemCode").Value
RecSet.MoveNext()
Next i
End While
End Sub
Please if anyone can help me I will be very grateful.