Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I delete a table?

Status
Not open for further replies.

fergman

Technical User
Oct 19, 2000
91
US
I'm trying to do a simple removal of a table, and after my handy dandy book I came up with a drop table statement that looks like this, but it doesn't work:

SQL = "DROP TABLE " & companyName & ""
Rs.Open SQL, outsales, 1,3

It gives me a Syntax error. I've never even had the need to delete a table before, but now I do. it's possible isn't it?
companyName is a vbscript variable passed from the previous page.
 
Set editCmd = Server.CreateObject("ADODB.Command")
editCmd.ActiveConnection = ConnectionString
editCmd.CommandText = "DROP TABLE " & companyName
editCmd.Execute
editCmd.ActiveConnection.Close
Set editCmd = nothing

BDC.
 
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "some connection string"
objConn.Execute("DROP TABLE '" & companyName & "'")
objConn.Close
Set objConn = Nothing
 
Which is to say that if you're not requesting a recordset but are instead issuing a command, you use command objects and syntax, not recordset objects and syntax.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top