[help] MSHFlexgrid - not automatic Reupdate

telkomek's Avatar, Join Date: Oct 2010
Light Poster
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
File Type: zip VB6+SQL_proyek.zip (105.0 KB, 4 views)
0
telkomek's Avatar, Join Date: Oct 2010
Light Poster
I put this code to button_event:

PHP Code:
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?