Looks like I can't stop having problems with SQL haha
I'm trying to delete a value from a database using the following code, and I have no idea where it's going wrong. It gives the messageboxes saying the operation goes through ok, but doesn't actually delete the data. Here's my code :
Dim TuneTitle As String = TuneTitleBox.Text
Dim FilePath As String = FilePathBox.Text
Dim DataCommand As New SqlCeCommand
Dim DeleteString As String = "DELETE FROM Music WHERE TuneTitle ='" & TuneTitle & "' AND Filepath ='" & FilePath & "'"
MessageBox.Show(DeleteString)
sqlcon.Open()
DataCommand = sqlcon.CreateCommand
DataCommand.CommandText = DeleteString
'check both values entered
If TuneTitle <> "" And FilePath <> "" Then
Try
DataCommand.ExecuteNonQuery()
MessageBox.Show("'" & TuneTitle & "' was successfully removed from the database")
Catch ex As Exception
MessageBox.Show("Please ensure that the values you have used exist in the database")
End Try
Else : MessageBox.Show("Please enter both the Tune Title and File Path")
End If
sqlcon.Close()
Thanks