Dim sqlNm As String = "" Dim sqlNm2 As String = "" Dim strType As String = "" Dim newSQL As String = "" '~~~~~~~~~~~~~~~~~~~~~~~~~~~ Call cbfDataSQLDeclaration() '~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'sqlNm = "select CONm,APId,BUId from tblwfcorules where coid = '" & COBiodataID & "'" 'norsan comment out the above code.Replace with stored proc below. 10/1/2012 sqlNm = "" sqlNm = "EXECUTE sp_executesql N'EXEC dbo.spPRMWFCORulesByCOID ''" & Trim(COBiodataID) & "'''" Try dataSql.SelectData(connectionstring, dr, sqlNm, Nothing) If Not dr Is Nothing Then If dr.HasRows() Then dr.Read() apID = IIf(Convert.IsDBNull(dr("APId")), "", dr("APId").ToString) buID = IIf(Convert.IsDBNull(dr("BUId")), "", dr("BUId").ToString) End If End If dr.Close() Catch ex As Exception : Log.HrmisLog(Page.AppRelativeVirtualPath, "SQL1", Security.GetUserIDBS, ex.Message, True, True, False) Finally : Call cbfDataSQLDispose() End Try
DIM cmd as SQLCommandcmd.Connection = [connection]cmd.CommandType = storedprocedurecmd.CommandText = "dbo.spPRMWFCORulesByCOID"cmd.Parameters.Add("@COID", [Data Type], [Parameter Value]) ' I think this is one way to do the syntaxcmd.Execute