I am successfully adding stored procedures to an Access database. However,
I need to be able to check if the stored procedure of the same name already
exists.
Is there a way to do this other than waiting for the OleDbException caused
when adding one that already exists?
Here is the code snippet:
Private Sub CreateStoredProcedures()
Dim alSql As New ArrayList
alSql.Add("CREATE PROC usp_ProjectResultsByID(inID VARCHAR(50)) AS SELECT
* FROM qryResults WHERE ID = inID")
If dbConnection Is Nothing Then
dbConnection = New OleDbConnection(connectionString)
dbCommand = New OleDbCommand
End If
dbCommand.Connection = dbConnection
dbConnection.Open()
Dim i As Integer
For i = 0 To alSql.Count - 1
dbCommand.CommandText = DirectCast(alSql(i), String)
dbCommand.ExecuteNonQuery()
Next
dbConnection.Close()
End Sub
Any help is greatly appreciated.
carl