I have a stored proceedure on my SQL server called SP_DROP. Basically, it drops a table from the database. the SP requires a parameter containing the name of the table to drop. SP looks like this:
code:
CREATE PROCEDURE SP_DROP(@tablename varchar(50))
AS
DECLARE @InsertString NVARCHAR(500)
Set @InsertString = 'drop Table ' + @tablename
execute sp_executesql @InsertString
GO
the Code in access looks like this:
Code:
Dim delTable As String
delTable = InputBox("Enter table to delete from the database", "Delete Table")
With DropTable
.ActiveConnection = cn
.CommandText = "SP_DROP"
.CommandType = adCmdStoredProc
.Parameters.Refresh
.Parameters(1) = delTable
.Execute
MsgBox "Table Dropped"
End With
I get an error "Item cannot be found in the corresponding ordinal." on the .Parameter(1) = deltable. If I comment out that line I get an error message stating the @tablename is an expected parameter.
Help.
code:
CREATE PROCEDURE SP_DROP(@tablename varchar(50))
AS
DECLARE @InsertString NVARCHAR(500)
Set @InsertString = 'drop Table ' + @tablename
execute sp_executesql @InsertString
GO
the Code in access looks like this:
Code:
Dim delTable As String
delTable = InputBox("Enter table to delete from the database", "Delete Table")
With DropTable
.ActiveConnection = cn
.CommandText = "SP_DROP"
.CommandType = adCmdStoredProc
.Parameters.Refresh
.Parameters(1) = delTable
.Execute
MsgBox "Table Dropped"
End With
I get an error "Item cannot be found in the corresponding ordinal." on the .Parameter(1) = deltable. If I comment out that line I get an error message stating the @tablename is an expected parameter.
Help.