1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[help] MSHFlexgrid - not automatic Reupdate

Discussion in 'Visual Basic ( VB )' started by telkomek, May 20, 2011.

  1. telkomek

    telkomek New Member

    Joined:
    Oct 11, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    my class project. i'm confused about:
    - insert data

    • avoid data duplicate (in database & mshflexgrid)
    • join table
    • auto number primary key that not used can be insert/updateable

    - insert, update & delete

    • not showing / refresh automatically to mshflexgrid
     

    Attached Files:

  2. telkomek

    telkomek New Member

    Joined:
    Oct 11, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    I put this code to button_event:

    PHP:
    01    On Error GoTo ErrT
    02        
    If mValidateControl.Validate(txtKode0txtKode0.Text <> "") = True Then
    03            MsgBox 
    "Kode Bahasa belum diisi"
    04        Else
    05        Rs.MoveFirst
    06            
    If Not (Rs.EOF True And Rs.EOF TrueThen
    07            
    While Not Rs.EOF
    08                
    If Rs("kdBhs") = txtKode0.Text Then
    09                    MsgBox 
    "data sudah ada"
    10                Else
    11                    Rs.AddNew
    12                    Rs
    ("kdBhs") = txtKode0.Text
    13                    Rs
    ("jnsBhs") = txtJenis2.Text
    14                    Rs
    ("nmBhs") = txtNama3.Text
    15                    Rs
    .Update
    16    
    '            sql = "Insert Into Bahasa"
    17    '            
    Cmd.CommandText sql
    18    
    '            Cmd.Execute
    19                End If
    20                Rs.MoveNext
    21            Wend
    22            End If
    23        End If
    24    '       
    Rs.Requery
    25    
    '       Rs.UpdateBatch
    26           '
    MSHFlexGrid1.Redraw True
    27           
    'MSHFlexGrid1.Refresh
    28            Call FillFromRecordset_FlexGrid(MSHFlexGrid1, Rs, False)
    29    ErrT:
    30    '   
    If Err 2147467259 Then
    31    
    '        'this will simply ignore the error and exit the routine
    32    
    '        Exit Sub
    33    '    
    Else
    34    '        'this will display the error message for any other error that occurred
    35            MsgBox 
    "Data Sudah ada"
    36            SelectTextFocus txtKode0
    37    
    '        Exit Sub
    38    '    
    End If
    why every update database, flexgrid not show the last result from last updated database?
     

Share This Page