merahPutih 2 Report post Posted June 22, 2012 (edited) salam, aku gune code ni kat vb2008 utk delete data (database = access) xde error, tapi bile ak check balik data x delete pun ** pop up msg MsgBox("Failed to delete") cemane ak nak check query ak tu betul ke salah??? [code] Dim cmdlocal As OleDbCommand Dim cnLocalMDB As NEW OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\Database.mdb;") strSQL = "DELETE FROM MyTable WHERE TransactionDate = #6-22-2012 3:51:26 #" cmdlocal = cnLocalMDB.CreateCommand() cmdlocal.CommandText = strSQL Dim maxRows As Integer = cmdlocal.ExecuteNonQuery() If maxRows = 1 Then MsgBox("data successfully deleted") Else MsgBox("Failed to delete") End If [/code] ** TransactionDate dlm format date/time ** query ni berjaya delete data ---> strSQL = "DELETE FROM MyTable" tapi aku kne perlukan condition tu tlg la suggestkan care nak setel mende ni....puas dah ak google sume x bley pakai TQ Edited June 22, 2012 by merahPutih Quote Share this post Link to post Share on other sites
merahPutih 2 Report post Posted June 25, 2012 (edited) ok ... setel... datetime format ak salah.... [color=#000000]strSQL [/color][color=#666600]=[/color][color=#000000] [/color][color=#008800]"DELETE FROM MyTable WHERE TransactionDate = #6/22/2012 3:51:26 PM #"[/color] Edited June 25, 2012 by merahPutih Quote Share this post Link to post Share on other sites