Jump to content
Sign in to follow this  
merahPutih

Data X Di Delete

Recommended Posts

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 by merahPutih

Share this post


Link to post
Share on other sites
ok ...
setel...
datetime format ak salah.... :12:

[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 by merahPutih

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...