Hi Dw

I'm having a problem in deleting a record in Access database. The error that is thrown is:

No value given for one or more required parameters
What I'm tying to do is to find a record by a name and also delete the record by name instead of using the ID I just don't want to include the ID even on my database but even if I remove the ID field on my database the error still occures. Here is the code that I'm trying to use to delete the record.

cmdDelete.CommandText = "DELETE FROM just WHERE folder =test" & ";"
        cmdDelete.CommandType = CommandType.Text
        cmdDelete.Connection = cnnOLEDB
        cmdDelete.ExecuteNonQuery()
        MsgBox("Record deleted.")
        cmdDelete.Dispose()
        MsgBox("Enter the required values")
        cmdUpdate.Dispose()

Recommended Answers

All 2 Replies

The command looks dicey to me. What is 'test'? If it's a variable, the string is constructed incorrectly:

"DELETE FROM just WHERE folder = '" & test & "';"

If it's a literal value, you need to say as such in the string:

"DELETE FROM just WHERE folder = 'test';"

Either way, I suspect you're checking a string value, in which case single quotes are needed.

Thank you.

about the part where I wrote wrong the variable it was went wrong when I copied the code from my VS and pasted here and started removing some other things then I didn't notice that it ended up that way. But thank the problem was that I needed to put the '' so I just did as you said them boom the record is deleted.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.