Web Connection
Re: Sql Session
From: | MatNat |
To: | Rick Strahl |
Hi,
I solved ... the problem was due to the format of the date and time. My sql server support Italian format (dd-mm-yyyy) so when wwSeesion.prg was performed the store procedure "sp_ww_LocateSession" this was in error, because the Datetime function return a date in american format.
Here the changes implemented:
FUNCTION LocateSessionPARAMETERS lcSessionId lcSessionId=IIF(type("lcSessionId")="C",lcSessionId,THIS.cSessionId)SETHOURSTO 24 *** MySETDATETO italia *** MyTHIS.oSQL.cSQLCursor = "wwsession"IFTHIS.oSql.Execute("Exec sp_ww_LocateSession ?lcSessionId,'" + ttoc(DATETIME() - THIS.nSessionTimeout)+"'") # 1 ***My**IF THIS.oSql.Execute("Exec sp_ww_LocateSession ?lcSessionId," + TimeToCStrict(DATETIME() - THIS.nSessionTimeout,.T.)) # 1 Orginal RETURN .F.ENDIFIFRECCOUNT() > 0 SCATTERNAMETHIS.oData MEMOTHIS.cSessionId= wwSession.SessionIdRETURN .T.ENDIFSCATTERNAMETHIS.oData MEMOBLANKTHIS.cSessionId=""IF lcSessionId = "BLANK"RETURN .T.ENDIFRETURN .F. ENDFUNC
Thanks for the support
Matias
Good morning Rick,
the connection and query on wwsession table work properly.
I'm using windows 8 and sql server 2012, is perhaps have some compatibility problems?
thanks
Matias
YOu should make sure your SQL connection is working and you can access the wwSession table.
Something along the lines of:
DO wconnect loSql = CREATE("wwSQL") ? loSql.Connect("yourconnectionstringhere") ? loSql.cErrorMsg ? loSql.Execute("Select * from wwSession")Browse
+++ Rick ---
Hi,
I'm trying to save session data in sql server table.
I have already enabled variables in wconnect.h file as indicated in the documentation, created tables through your wizard, and set the connection string in my ini file.
Now I'm initializing the session with the command:
Process.InitSession("Test")
when I try to save a variable in session, the command:
Session.SetSessionVar("Matias","1")
return an error because the Session.oData is not an object:
FUNCTION SetSessionVarLPARAMETERS lcVarName, lcValueLOCAL lctext, lcValue, lcOldAlias, loData lcVarName = lower(lcVarname) loData = THIS.oDataIFEMPTY(lcValue) lcValue = ""ENDIF*** New Id value lcText="<"+lcVarName+">"+TRANS(lcValue)+"</" + lcVarName + ">"+CHR(13)IFATC("<"+lcVarName+">",loData.vars) > 0 **** .... ....
This.oData is null and I can not understand if I forget something or if I'm wrong to initialize the session. Does anyone know how to help me or can send some examples?
thank you very much
Matias