views:

117

answers:

3

Hello! I've got an ASP document that 5 years old. Actually I'm working with PHP but I must use ASP for a Windows Application. So I need someone to explain this function to me.

//DNS SETTINGS ARE INCLUDED ALREADY.

function Check_Is_Web_Locked()
    dim cmdDB , Ret
    OpenDatabase 
    Set cmdDB = Server.CreateObject("ADODB.Command")
            With cmdDB
                .ActiveConnection = DBCon
                .CommandText = "TICT_CHECK_WEB_STATUS"
                .CommandType = adCmdStoredProc
                .Parameters.Append .CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, 0)
                .Execute,,adExecuteNoRecords
                Ret = Trim(.Parameters("RETURN_VALUE"))

            End With
            Set cmdDB = Nothing
            CloseDatabase

            Check_Is_Web_Locked = Ret

end function

What does this function do?

Is "TICT_CHECK_WEB_STATUS" a StoredProcedure?

If it's what are the coulumns that function looking for?

+8  A: 

Yes, TICT_CHECK_WEB_STATUS is a stored procedure in the database. This SP returns a "signed integer" output parameter called RETURN_VALUE, whose value gets stored in the Ret variable when it is returned from the SP.

The Trim function should strip out any white-space from RETURN_VALUE, but since it is an integer there will never by any. Therefore it is simply converting the return value into a string.

Finally the function is returning the Ret string. This is done with the Check_Is_Web_Locked = Ret statement.

Daniel Vassallo
Thank you for your answer!
Ronnie Chester Lynwood
So.. What is ".Parameters.Append .CreateParameter("@pTLoginName", adVarChar, adParamInput, 15,strLoginName)" this line means?
Ronnie Chester Lynwood
@Ronnie: That would be passing an input parameter to the stored procedure. The stored procedure would be expecting the input parameter called `@pTLoginName` of type `varchar` (string). The `strLoginName` would be a variable in the ASP script. Basically you would be passing a value to the stored procedure.
Daniel Vassallo
Thank you so so so much for these comments! I will try to fix my problem but is there any way to contact to you? I've got more questions :/
Ronnie Chester Lynwood
@Ronnie: Yes, feel free to send me an email at `[email protected]`. Replace `namesurname` with my real name and surname. However, I really suggest you post on Stack Overflow if you have more questions or require further assistance. You are almost guaranteed to get quality answers in here.
Daniel Vassallo
Thank you. I sent you a test e-mail. reply me if you got it :)
Ronnie Chester Lynwood
+1 For great explanation.
Wonde
+3  A: 

This looks like it's just a heartbeat of sorts to the database (i.e. the web page is saying "Hey Database, are you alive?" by calling TICT_CHECK_WEB_STATUS). And yes, TICT_CHECK_WEB_STATUS is a stored proc.

Jaxidian
+2  A: 

TICT_CHECK_WEB_STATUS is apparently a stored proc that returns an output parameter value called Return_Value. That value is stored in a variable called Ret.

user279521