All pastes #184758 Raw Edit

Anonymous

public text v1 · immutable
#184758 ·published 2006-09-28 07:26 UTC
rendered paste body
	function run_proc(byref cmd, proc_name, exec_type)
		on error resume next
		
		dim bool, member, param
		
		bool = true
		
		cmd.activeConnection = ado
		cmd.commandText = proc_name
		cmd.commandType = adCmdStoredProc
		cmd.parameters.refresh
		
		for each member in cmd.parameters
			param = replace(member.name, "@", "")
			if not isempty( request(param) ) then
				cmd.parameters(member.name) = request(param)
			end if
		next
		
		cmd.execute , , exec_type
		
		if err.number <> 0 then
			run_proc = err.description
		else
			run_proc = true
		end if
	end function

	if not isempty(request.form("btnEditAccount")) then
		set adoProc = server.createObject("ADODB.Command")
		
		proc = run_proc(adoProc, "sp_updateAdminUserDetails", adExecuteNoRecord)
		
		if proc = true then
			status_msg = "<p class=""success"">Successfully Updated Administrator Account</p>"
		else
			status_msg = "<p class=""error"">ERROR: Could not update administrator account.<br /><br />"& proc &"</p>"
		end if
		
		set adoProc = nothing
	end if