I have used oledb connection with sql to populate one of my listbox with data from the database. However, I have to remove. on click of a button. the information from a specific table called 'Salary'. The problem that I am having is that when I tried to remove the 'Salary' table, it is not letting me do so. I says that another table called 'Employees Information' has details from the 'Salary'. How do I remove the 'Salary' table. I don't know if it is possible without removing the other table. If so, how do I do that? Can anyone help me?


There are two thing that we need to take care.
1. do we have need to delete table Or
2. We need to delete data

If you want to delete data only then you can use sql command

Delete from salary

and then you can re add data manually or automatically.

Hi Alekhan,

I need to delete from the table called 'Salary' in where there is a column called 'hours'. How do I do that?


VB.net will not allow you to delete until you have relationship between Employee Information and Salary, To delete Table you must delete the Relationship between Salary and Emp Info Tables.

Hi Alekhan,

Yes, that is the issue that I am having. I am stuck pretty much there. How do I delete the relationship by using the code rather than doing it manually?


Hi Alekhan,

Here is the sample code:

Dim myConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\ nwind.mdb;User Id=admin;Password=;")
Dim myCmd As New OleDbCommand
Dim mySQL As New StringBuilder

mySQL.Append("Delete From Products ")

myCmd.Connection = myConn
myCmd.CommandType = CommandType.Text
myCmd.CommandText = mySQL.ToString()



Catch ex As Exception
If myConn.State = ConnectionState.Open Then
End If
End Try

I am using Northwind sample database

This article has been dead for over six months. Start a new discussion instead.