Skip to Content
avatar image
Former Member

Loading Values into a Grid

Hi All,

i am taking a employee id from ohem and populating it in my query to get the entire information.when i am populating i am getting only on employee id.how to get all the employee id's information at a time

my code is as follows

strQuery = "SELECT empid FROM [OHEM]"

objRecordSet.DoQuery(strQuery)

If objRecordSet.RecordCount > 0 Then

For inti As Integer = 0 To objRecordSet.RecordCount - 1

strEmployeeNo = objRecordSet.Fields.Item(0).Value

strGridQuery = "SELECT pf,basic,deductions etc where empid=''stremployeeno"

objRecordSet.MoveNext()

Next

here i am getting the information of only first employee

i am having a list of 12 employees

how to get all the employees

i wrote the query also as

strGridQuery += "SELECT pf,basic,deductions etc where empid=''stremployeeno"

regards

Micheal

Edited by: Micheal Vasanth on Sep 4, 2008 1:03 PM

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Sep 04, 2008 at 07:38 AM

    Hi Michael,

    i don't get the point 😊

    why you fill the grid like this c# sample:

    .
    oForm.DataSources.DataTables.Add("MyDataTable");
     
    ((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).DataTable = oForm.DataSources.DataTables.Item("MyDataTable");
     
    oForm.DataSources.DataTables.Item(0).ExecuteQuery("select empID, lastName, FirstName, jobTitle from ohem");
     
    ((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).CollapseLevel = 1;
    ((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).AutoResizeColumns();
     
    ((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single;
    

    .

    you see i inserted this query in executequery

    select empID, lastName, FirstName, jobTitle from ohem

    (extend it with your needs)

    the grid will be filled with all emploeyees and the information from the select

    lg David

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 08:01 AM

    Hi,

    Dim oForm As SAPbouiCOM.Form

    Dim oGrid As SAPbouiCOM.Grid

    oGrid = oForm.Items.Item("4").Specific

    oForm.DataSources.DataTables.Add("D_1")

    oGrid.DataTable = oForm.DataSources.DataTables.Item("D_1")

    strGridQuery = "SELECT empid ,pf,basic,deductions etc where empid in

    (SELECT empid FROM OHEM) order by empid "

    oForm.DataSources.DataTables.Item(0).ExecuteQuery(strGridQuery )

    oGrid.CollapseLevel = 1

    oGrid.AutoResizeColumns()

    try this code.

    u can get all vales for all employess & it will come employee wise

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 09:29 AM

    Hi,

    Try this Code:

    Dim oGrid As SAPbouiCOM.Grid

    oGrid = oForm.Items.Item("Grid").Specific

    oForm.DataSources.DataTables.Add("Table")

    oGrid.DataTable = oForm.DataSources.DataTables.Item(Table")

    strGridQuery = "SELECT empid ,pf,basic,deductions etc where empid in

    (SELECT empid FROM OHEM) order by empid "

    oForm.DataSources.DataTables.Item(0).ExecuteQuery(strGridQuery )

    oGrid.CollapseLevel = 1

    oGrid.AutoResizeColumns()

    Kind Regards

    Mohana

    Add comment
    10|10000 characters needed characters exceeded