[Last Call] Learn how to a build a cloud-first strategyRegister Now


Delete row from database using oledbcommand

Posted on 2006-04-29
Medium Priority
Last Modified: 2010-08-05
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

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!
Question by:ab2ae
LVL 70

Accepted Solution

Éric Moreau earned 2000 total points
ID: 16568955
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 & "' "


Author Comment

ID: 16568997
brilliant!! :o)

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question