Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
belcherman
Starting Member
5 Posts |
Posted - 2007-09-29 : 23:15:37
|
| I seem to be getting tasks that I am not familiar with these days. I am aguy that has coded it all in the asp page or in the code behind in .NET.This problem is outlined below and I need a help / advice on doing this. Ihad the flow of the 3 parts to it expanded below. A call is made to a StoredProcedure, The SP then calls a user defined function that runs SQL, thisreturns a 1 or 0 to the SP which then returns the value back to the call onthe asp page. This is a lot I know but it is the way the lead guy wants itdone. Any help so I can keep most of the hair I have left is appreciated :-)Short list of process flow:1. Form.asp calls to rx_sp_HasAccessToClient in SQL SERVER2. rx_sp_HasAccessToClient then calls ab_HasAccessToClient 3. ab_HasAccessToClient runs SQL command on db and sends return bit back torx_sp_HasAccessToClient4. rx_sp_HasAccessToClient then sends this back to the call in the Form.asppage5. Form.asp then checks the Boolean and if 1 then show or if 0 then deny.<FLOW WITH CODE AND FUNCTIONS :>This is not the correct syntax but is showing what I understand sort of howthis is to be done so far. This panel loads up the Vendors and id's when the user clicks on the link"view detailed list of vendors associated with this client". This is thebeginning of the process.This is code in Form.asp'PANEL ONEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX---->If ValidateInput(Request.Querystring("Postback"))="Fo rmDetails" then 'CheckPostback Type'We need to load up vendors associated with the current client.'--------- CHECK ACCESS HERE via function ab_HasAccessToClient--------'If the call returns 1, then the employee has access.'Otherwise, just write out "Access to this client is denied."'CALL SP - Not sure what parameters need to go with it or its syntaxExecute_SP("rx_sp_HasAccessToClient '" & ClientSSN & "', 1)'When it returns can check it here........if ab_HasAccessToClient result is a 1 then 'boolean would be 1 so show panelElse'boolean would be 0 so show access denied'allow them to go back to the original page.end if'PANEL ONEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX---->ON SQL SERVER: Stored Procedure------------------------------------------------------------------------------------------rx_sp_HasAccessToClient CREATE PROCEDURE [dbo].[ rx_sp_HasAccessToClient] @EmployeeID INT,@ClientSSN varchar(50),@ReturnBitValue = OUTPUT/*' Parameters here passed via call from Form.asp - not sure what is passedyet.*/ASset nocount on/*Written by Mike Belcher 9/27/2007 for Form.asp'Calls ab_HasAccessToClient function - not sure of the syntax as of yet,just making flow.'Gets return bit and passes that back to the call from Form.asp*/GO------------------------------------------------------------------------------------------ON SQL SERVER: User-Defined Function------------------------------------------------------------------------------------------ab_HasAccessToClientCREATE FUNCTION ab_HasAccessToClient (@employeeID INT, @ClientSSNVARCHAR(50))@ClientSSN varchar(50),@EmployeeID,@ReturnBitValue = OUTPUTAS SELECT 1FROM tblEmployeesClients ecINNER JOIN tblClients c ON ec.ClientID = c.ClientSSNINNER JOIN tblEmployees e ON ec.Employee = e.EmployeeLogInNameWHERE e.EmployeeID= @EmployeeIDAND c.InActiveClient=0AND c.ClientSSN = @ClientSSN'Some Code here to save result bit ..RETURN @ReturnBitValue 'Back to rx_sp_HasAccessToClient ------------------------------------------------------------------------------------------</FLOW WITH CODE AND FUNCTIONS :> |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-09-29 : 23:39:46
|
| Not sure what you are after here - just the calls?in the spselect @ReturnBitValue = dbo.ab_HasAccessToClient(@EmployeeID, @ClientSSN)for the call to the sp seehttp://www.nigelrivett.net/DOTNET/DotNetDBAccess.html==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|
|
|