The problem is when i delete a records from the listview, it deleted but when i look unto database it doesn't deleted.
Please help me solve this problem:

Here's my recent code:

Module1.connect()

        Dim sqlconn As New OleDb.OleDbConnection
        Dim Button = MessageBox.Show _
        ("Are you sure you want to delete this Data?", _
        "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)
        If Not ListView1.SelectedItems.Count = 0 Then
            If Button = Windows.Forms.DialogResult.Yes Then
                Dim sqlcmd As New OleDb.OleDbCommand("DELETE FROM table1 WHERE Processor="", Memory="", VideoCard="", HardDrive="", AntiVirus="" ", sqlconn)
                ListView1.Items.Remove(ListView1.SelectedItems.Item(0))
                MsgBox("Record Removed Successfully~!", MsgBoxStyle.Critical)
            Else
                MsgBox("No Record Selected.", MsgBoxStyle.Critical)
            End If
        Else
            MsgBox("No Record Selected.", MsgBoxStyle.Critical)
        End If
        sqlconn.Close()

DELETE FROM table1 WHERE Processor="", Memory="", VideoCard="", HardDrive="", AntiVirus="" "

Shouldn't there be AMD betweem variables instead of commas?

DELETE FROM table1 WHERE Processor="" AND Memory="" AND VideoCard="" AND HardDrive="" AND AntiVirus=""

Another possibility: use Nothing instead of ""

DELETE FROM table1 WHERE Processor=Nothing AND Memory=Nothing AND VideoCard=Nothing AND HardDrive=Nothing AND AntiVirus=Nothing

Which of the above (if any) is correct will depend on the contents of the database.

Hey bro, thanks for the response.. but..
i think the problem in my program is not connecting into the database...
it just deleting the records that listed in the listview but its not affecting my database..
please help me solve this^^

Huh? I didn't say anything about connecting to the database. What I mentioned is the SQL statement required to delete a row from the database after the connection has been made.

You need to get the values of the columns from the listview row you want to delete and plug them into the SQL statement which is probably why the sql statement doesn't work.

the SQL statement is correct,. but the connecting to the database is something wrong.
could you give me a code to connect to my database.~? my database is SERVICE-BASED DATABASE...

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.