ADO.NET Drop command In VB.NET
Here we see how to use ADO.net to connect to a SQL Server database and drop the records and table structure from the database.
Here we see how to use ADO.net to connect to a SQL Server database and drop the records and table structure from the database. To do that we create a table in SQL Server database which has the name emp2 and use drop command to removes the table from database.
Creating connection object
To create a connection we pass the connection string as a parameter in connection object.
Dim str As String = "Data Source=.;uid=sa;pwd=123;database=master"
Dim con As New SqlConnection(str)
Drop command
The drop command is used to removes the rows and structure of the table from the database. delete command is used to delete the only row's of the table not structure of the table but delete data can be rollback. Drop command does not allows rollback of removal data. this is a DDL statement. which has the below command:
Dim com As New SqlCommand("drop table emp2", con)
Now we create a database table and insert some values in this table. Table looks like this.

For example
The above table has a name emp2 and also has data. The below example defines the drop command to drop the table from database.
Imports System.Data.SqlClient
Module Module1
Sub Main()
Dim str As String = "Data Source=.;uid=sa;pwd=123;database=master"
Dim con As New SqlConnection(str)
Try
con.Open()
Dim com As New SqlCommand("drop table emp2", con)
com.ExecuteNonQuery()
Console.WriteLine("Table has been droped")
Catch ex As Exception
Console.WriteLine("can not droped table")
End Try
End Sub
End Module
OUTPUT

Now open the database and use select statement to view the table test it.
