Dear All,
Sy punya script (terlampir dibawah) untuk fungsi
penghapusan record, namun record yang ingin dihapus
tersebut tidak hilang/terhapus dari tabel, padahal
saat runtime ngga ada masalah (kita klik tombol
delete, proses lancar, tapi record tetap ada/tidak
terhapus). Mungkin ada rekan² yang bisa membantu.
Thank's before & Happy New Year 2006
rgds
My Script :
Private Sub Form_Load()
Set MyDb = New ADODB.Connection
MyDb.CursorLocation = adUseClient
MyDb.Open "PROVIDER=SQLOLEDB;" & _
"Data Source=" & ServerName & ";" & _
"Initial Catalog=" & DatabaseName & ";" & _
"User Id=" & dbUserName & ";" & _
"Password=" & dbPassword & ";"
MyDb.Execute "set dateformat dmy"
Set MyRs = New ADODB.Recordset
MyRs.Open "Select * From DYEINGS Order By NOSO",
dbDye, _
adOpenDynamic, adLockPessimistic
SetHeaderGrid
End Sub
Private Sub cmdDelete_Click()
On Error GoTo DeleteErr
If MsgBox("Hapus No. SO " &
Datagrid1.Columns(0).Text & " " & _
Datagrid1.Columns(1).Text & " ?", vbQuestion + _
vbYesNo , "Delete Record") = vbNo Then _
Exit Sub
Dim xBatch As Integer
With MyRs
nBatch = !BATCH
.MoveNext
If .EOF Then
.MoveLast
.MovePrevious
End If
xBatch = !BATCH
End With
With dbDye
.BeginTrans
.Execute "Delete From MYTABLE Where BATCH=" &
nBatch
.CommitTrans
End With
SetHeaderGrid
Datagrid1.SetFocus
MyRs.Find "BATCH Like " & xBatch, , adSearchForward,
1
Exit Sub
DeleteErr:
MsgBox Err.Description
End Sub
__________________________________________
Yahoo! DSL Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income homes are not online. Make a difference this holiday season!
http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/zCsqlB/TM
--------------------------------------------------------------------~->
Untuk berhenti berlangganan kirim email kosong ke : [EMAIL PROTECTED]
Ikuti juga forum diskusi VB.net dengan
mengirim email kosong ke [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/indoprog-vb/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/