I put this code to button_event:

01    On Error GoTo ErrT
02        If mValidateControl.Validate(txtKode0, txtKode0.Text <> "") = True Then
03            MsgBox "Kode Bahasa belum diisi"
04        Else
05        Rs.MoveFirst
06            If Not (Rs.EOF = True And Rs.EOF = True) Then
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?

Create a procedure to select data from table and display it to flexgrid.
Then call this procedure after adding data or any at event that you want.

This article has been dead for over six months. Start a new discussion instead.