Delete row from database using oledbcommand

Hi experts,

here is my code, i just want to delete a row in the database based on an SQL statement

Dim cn As OleDbConnection

'connection string (path of database)
        strConn = "Provider = Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=" & dataSource

        'creating a new connection object with connection string
        cn = New OleDbConnection(strConn)

        'opening the connection
        cn.Open()

strSQL = "DELETE * " & _
            "FROM PlayList " & _
            "WHERE userID = " & userID & " AND playListTitle = " & playListName & " "

            cmd = New OleDbCommand(strSQL, cn)
            cmd.ExecuteNonQuery()       '*****ERROR*****  no value given for one or more required parameters

I have no idea what the error above means but need this working today!
ab2aeAsked:
Who is Participating?
 
Éric MoreauSenior .Net ConsultantCommented:
Hi ab2ae,

1. Remove the * after the Delete keyword
2. characters fields must have values surrounded by single quotes

strSQL = "DELETE  " & _
            "FROM PlayList " & _
            "WHERE userID = " & userID & " AND playListTitle = '" &  playListName & "' "


Cheers!
0
 
ab2aeAuthor Commented:
brilliant!! :o)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.