Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Visual Basic ( VB ) (http://www.go4expert.com/forums/visual-basic/)
-   -   [help] MSHFlexgrid - not automatic Reupdate (http://www.go4expert.com/forums/help-mshflexgrid-automatic-reupdate-t25840/)

telkomek 20May2011 08:42

[help] MSHFlexgrid - not automatic Reupdate
 
1 Attachment(s)
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

telkomek 20May2011 10:57

Re: [help] MSHFlexgrid - not automatic Reupdate
 
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?


All times are GMT +5.5. The time now is 23:34.