Results 1 to 6 of 6

Thread: DataGrid

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    76

    DataGrid

    here i've got problem with datagrid....as i was not solving using datacontrol but using a recordset actually i've two datagrid n just to display from the click event of lstPupils so this error somes....as code is stated as below...

    VB Code:
    1. Private Sub lstPupil_Click()
    2.     Dim intID As Integer
    3.    
    4.    Call data_connection
    5.    
    6.     intID = CInt(lstPupil.ItemData(lstPupil.ListIndex))
    7.    
    8.     strSQL = "SELECT Description FROM tblCompetency WHERE Code NOT IN(SELECT Code FROM tblPass WHERE ID= " & CStr(intID) & ")"
    9.    
    10.     Set rsCom1 = gconn.Execute(strSQL)
    11.     'rsCom.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
    12.    
    13.     Set DataGrid1.DataSource = rsCom1  Error here...[COLOR=Red]The rowset is not bookmarkable
    14.     [/COLOR]
    15.    
    16.     strSQL = "SELECT Description FROM tblCompetency WHERE Code IN(SELECT Code FROM tblPass WHERE ID=" & CStr(intID) & ")"
    17.    
    18.     Set rsCom2 = gconn.Execute(strSQL)
    19.    
    20.     Set Me.DataGrid2.DataSource = rsCom2
    21.    
    22.    
    23.    
    24. End Sub
    ]

    wat is there so plezz do help me

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: DataGrid

    Use a client-side cursor...

    VB Code:
    1. Private Sub lstPupil_Click()
    2.     Dim intID As Integer
    3.    
    4.     Call data_connection
    5.    
    6.     intID = CInt(lstPupil.ItemData(lstPupil.ListIndex))
    7.    
    8.     strSQL = "SELECT Description FROM tblCompetency WHERE Code NOT IN(SELECT Code FROM tblPass WHERE ID= " & CStr(intID) & ")"
    9.    
    10.     [B]rsCom1.CursorLocation = adUseClient[/B]
    11.    
    12.     'Set rsCom1 = gconn.Execute(strSQL)
    13.    
    14.     rsCom.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
    15.    
    16.     Set DataGrid1.DataSource = rsCom1
    17.    
    18.     strSQL = "SELECT Description FROM tblCompetency WHERE Code IN(SELECT Code FROM tblPass WHERE ID=" & CStr(intID) & ")"
    19.    
    20.     Set rsCom2 = gconn.Execute(strSQL)
    21.    
    22.     Set Me.DataGrid2.DataSource = rsCom2
    23.        
    24. End Sub
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    76

    Question Re: DataGrid

    here i did as u said but it didn'tworked out ya....some erro pop ups saying
    operation is not allowed when object is open
    but just after clicking i gat a record but when clicking to next records in lstpupils....
    n e ways belows describes in detals see my code aonce again ya...
    thanx for ur help....

    VB Code:
    1. Private Sub lstPupil_Click()
    2.     Dim intID As Integer
    3.    
    4. '    On Error GoTo err_trap
    5.    
    6.    
    7.     Call data_connection
    8.    
    9.     intID = CInt(lstPupil.ItemData(lstPupil.ListIndex))
    10.    
    11.     strSQL = "SELECT Description FROM tblCompetency WHERE Code NOT IN(SELECT Code FROM tblPass WHERE ID= " & CStr(intID) & ")"
    12.    
    13.     rsCom1.CursorLocation = adUseClient
    14.    
    15.     'Set rsCom1 = gconn.Execute(strSQL)
    16.     rsCom1.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
    17.    
    18.     Set DataGrid1.DataSource = rsCom1
    19.    
    20.    
    21.     strSQL = "SELECT Description FROM tblCompetency WHERE Code IN(SELECT Code FROM tblPass WHERE ID=" & CStr(intID) & ")"
    22.  
    23.     'Set rsCom2 = gconn.Execute(strSQL)
    24.     rsCom2.CursorLocation = adUseClient
    25.    
    26.     rsCom2.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
    27.    
    28.  
    29.     Set DataGrid2.DataSource = rsCom2
    30.    
    31. Exit Sub
    32.  
    33. 'err_trap:
    34. '    Dim strMsg As String
    35.    
    36.     gconn.Close
    37.    
    38.    
    39.    
    40. End Sub

    so help me plezzz....

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: DataGrid

    Then create another recordset object for your grid's datasource...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    76

    Question Re: DataGrid

    i did it as u say but it doesn't displays nothing..
    but u just see once how i did it ya...
    here is my code ...
    thnx for ur help dee_uu

    VB Code:
    1. Private Sub lstPupil_Click()
    2.     Dim intID As Integer
    3.    
    4.     Call data_connection
    5.    
    6.     intID = CInt(lstPupil.ItemData(lstPupil.ListIndex))
    7.    
    8.     strSQL = "SELECT Description FROM tblCompetency WHERE Code NOT IN(SELECT Code FROM tblPass WHERE ID= " & CStr(intID) & ")"
    9.    
    10.     rsDGrid.CursorLocation = adUseClient
    11.    
    12.     rsCom1.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
    13.    
    14.     Set DataGrid1.DataSource = rsDGrid
    15.    
    16.  
    17.     gconn.Close
    18.    
    19. End Sub

    thnx ..
    kaylu_mo

  6. #6
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: DataGrid

    VB Code:
    1. Private Sub lstPupil_Click()
    2.     Dim intID As Integer
    3.    
    4.     Call data_connection
    5.    
    6.     intID = CInt(lstPupil.ItemData(lstPupil.ListIndex))
    7.    
    8.     strSQL = "SELECT Description FROM tblCompetency WHERE Code NOT IN(SELECT Code FROM tblPass WHERE ID= " & CStr(intID) & ")"
    9.    
    10.     rsDGrid.CursorLocation = adUseClient
    11.    
    12.     [B]rsDGrid[/B].Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
    13.    
    14.     Set DataGrid1.DataSource = rsDGrid
    15.    
    16.  
    17.     gconn.Close
    18.    
    19. End Sub
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width