Advertisement
Advertisement
| 07.04.2008 at 08:56AM PDT, ID: 23539671 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: |
Public Shared Sub Create_sp_Public_Call(ByVal strConnection As String)
Using conApp As New SqlConnection(strConnection)
conApp.Open()
Using cmdSqlCommand As New SqlCommand("SELECT COUNT(*) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME='sp_Public_Call'", conApp)
If CType(cmdSqlCommand.ExecuteScalar, Integer) > 0 Then
cmdSqlCommand.CommandText = "DROP PROCEDURE sp_Public_Call"
Try
cmdSqlCommand.ExecuteNonQuery()
Catch ex As Exception
MsgBox("Cannot continue!" & vbCrLf & vbCrLf & "Failed to create the stored procedure.")
End Try
End If
cmdSqlCommand.CommandText = "CREATE PROCEDURE sp_Public_Call( " & vbCrLf
cmdSqlCommand.CommandText &= "@ParamFields VarChar(max) = Null, " & vbCrLf
cmdSqlCommand.CommandText &= "@ParamTable VarChar(max) = Null, " & vbCrLf
cmdSqlCommand.CommandText &= "@ParamOrderBy VarChar(max) = Null) " & vbCrLf
cmdSqlCommand.CommandText &= " WITH ENCRYPTION" & vbCrLf
cmdSqlCommand.CommandText &= " AS" & vbCrLf
cmdSqlCommand.CommandText &= " BEGIN " & vbCrLf
cmdSqlCommand.CommandText &= " DECLARE @strSQL VarChar(max) " & vbCrLf
cmdSqlCommand.CommandText &= " SET @strSQL = 'SELECT ParamFields FROM ParamTable ORDER BY ParamOrderBy'" & vbCrLf
cmdSqlCommand.CommandText &= " SET @strSQL = REPLACE(@strSQL,'ParamFields',@ParamFields)" & vbCrLf
cmdSqlCommand.CommandText &= " SET @strSQL = REPLACE(@strSQL,'ParamTable',@ParamTable)" & vbCrLf
cmdSqlCommand.CommandText &= " SET @strSQL = REPLACE(@strSQL,'ParamOrderBy',@ParamOrderBy)" & vbCrLf
cmdSqlCommand.CommandText &= " EXEC (@strSQL)" & vbCrLf
cmdSqlCommand.CommandText &= " END"
Try
cmdSqlCommand.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
MsgBox("Cannot continue!" & vbCrLf & vbCrLf & "Failed to create the stored procedure.")
End Try
End Using
End Using
End Sub
|