Results 1 to 4 of 4

Thread: datagrid for loop

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2011
    Posts
    26

    datagrid for loop

    Pls help me on how to make loop in datagrid to save values that is in datagrid,
    because I only know how in listview.

    Pls help me.

    Here's my code using for loop in LISTVIEW
    Code:
    For lngI = 1 To Listview1.ListItems.Count
        
         sql7 = "UPDATE [CREW02JOINERIMPORT] SET [CREW02JOINERIMPORT].OTHR = " & Listview1.ListItems(lngI).ListSubItems(71) & ", [CREW02JOINERIMPORT].DSA = " & Listview1.ListItems(lngI).ListSubItems(72) & ", [CREW02JOINERIMPORT].DLP = " & Listview1.ListItems(lngI).ListSubItems(73) & ", [CREW02JOINERIMPORT].LSBPRESENT = " & Listview1.ListItems(lngI).ListSubItems(74) & ", [CREW02JOINERIMPORT].LSBNEXT = " & Listview1.ListItems(lngI).ListSubItems(75) & ", [CREW02JOINERIMPORT].LSBNEXTDATE = '" & Listview1.ListItems(lngI).ListSubItems(76) & "', [CREW02JOINERIMPORT].HOMEALLOT1 = " & Listview1.ListItems(lngI).ListSubItems(77) & ", [CREW02JOINERIMPORT].HOMEALLOT2 = " & Listview1.ListItems(lngI).ListSubItems(78) & ", [CREW02JOINERIMPORT].HOMEALLOT1BANK = '" & Listview1.ListItems(lngI).ListSubItems(79) & "',[CREW02JOINERIMPORT].HOMEALLOT2BANK = '" & Listview1.ListItems(lngI).ListSubItems(80) & "',[CREW02JOINERIMPORT].UNIONDUE = " & Listview1.ListItems(lngI).ListSubItems(81) & " " & _
        "WHERE ([CREW02JOINERIMPORT].NO = " & Listview1.ListItems(lngI).ListSubItems(2) & ")"
    
              
        CONL.Execute  sql7 
    Next lngI
    Thank you in advance
    Last edited by kenichicka; Jul 20th, 2011 at 09:44 PM.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Jun 2011
    Posts
    26

    Re: datagrid for loop

    pls help me..

  3. #3
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 2007
    Location
    India
    Posts
    2,170

    Re: datagrid for loop

    datagrid is bounded with database, when u edit in datagrid, the database wil be updated automaticaly.
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jun 2011
    Posts
    26

    Re: datagrid for loop

    The data in datagrid is connected to SQL database.

    But here's the condition,

    I have to update the data in ACCESS database also whenever some changes made in datagrid.

    SOMETHING LIKE THIS:
    Attached Images Attached Images  

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