Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Database & Reporting

Post new topic   Reply to topic
whts wrong with the code??
View previous topic :: View next topic  
Author Message
azrina
Newbie


Joined: 22 Jan 2004
Posts: 3

PostPosted: Jan 23rd, 2004 11:45 AM    Post subject: whts wrong with the code?? Reply with quote

i want the data in my flexgrid to be saved in the database.
my problem is, it only saves the last line in the flexgrid, not from the first line..whts wrong with my coding??pls help..

here, i enclose the code

[vb]Private Sub btnSimpan1_Click()
Set Conn = GetConnection
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM pemeriksaanProduk", Conn, adOpenStatic, adLockOptimistic
Dim x
Dim y

'save value column 0
rs.AddNew
For x = 1 To MSFlexGrid1.Rows - 1
rs!Sampel = MSFlexGrid1.TextMatrix(x, 0)
Next

'save value column 1
For x = 1 To MSFlexGrid1.Rows - 1
rs!Jam_1 = MSFlexGrid1.TextMatrix(x, 1)
Next

'save value column 2
For x = 1 To MSFlexGrid1.Rows - 1
rs!Jam_2 = MSFlexGrid1.TextMatrix(x, 2)
Next

'save value column 3
For x = 1 To MSFlexGrid1.Rows - 1
rs!Jam_3 = MSFlexGrid1.TextMatrix(x, 3)
Next

'save value column 4
For x = 1 To MSFlexGrid1.Rows - 1
rs!Jam_4 = MSFlexGrid1.TextMatrix(x, 4)
Next

'save value column 5
For x = 1 To MSFlexGrid1.Rows - 1
rs!Jam_5 = MSFlexGrid1.TextMatrix(x, 5)
Next

rs.Update
rs.Close
Set rs = Nothing
MsgBox "Data Telah Disimpan", vbOKOnly, "Simpan Data"

End Sub [/vb]
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Database & Reporting All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic