Hi Valetin are you calling contact.release() custom objects doesn't have an release event so what you are defining is a custom method called release that must be called try doing the following:
DEFINE CLASS Contacts AS Custom OLEPUBLIC
strConnect="Provider=SQLOLEDB.1;Initial Catalog=MAPTracks;User ID=sa;Password=;Data Source=192.168.4.10;"
oConn = .NULL.
oCommand = .NULL.
FUNCTION Init()
This.oConn = CreateObject("ADODB.Connection")
This.oConn.Open(This.strConnect)
This.oCommand = CreateObject ("ADODB.Command")
This.oCommand.ActiveConnection = This.oConn
This.oCommand.CommandType = 1
ENDFUNC
FUNCTION Request(nContactType)
This.oCommand.CommandText = "Request "+ALLTRIM(STR(nContactType))
oRec = This.oCommand.Execute
RETURN oRec
ENDFUNC
FUNCTION GetContactTypes()
This.oCommand.CommandText = "GetContactTypes"
oRec = This.oCommand.Execute
RETURN oRec
ENDFUNC
FUNCTION Destroy()
This.oCommand.ActiveConnection = ""
This.oCommand = null
This.oConn.Close()
This.oConn = .NULL.
ENDFUNC
ENDDEFINE
>Hello everybody!
>
>I have a problem with my AS. May be someone can give me a hint why it is happening. It is my first try in this area.
>
>I have SQL Server database. I have created a project with my OLE class such as:
>
>DEFINE CLASS Contacts AS Custom OLEPUBLIC
> strConnect="Provider=SQLOLEDB.1;Initial Catalog=MAPTracks;User ID=sa;Password=;Data Source=192.168.4.10;"
>
> oConn = .NULL.
> oCommand = .NULL.
>
> FUNCTION Init()
> This.oConn = CreateObject("ADODB.Connection")
> This.oConn.Open(This.strConnect)
> This.oCommand = CreateObject ("ADODB.Command")
> This.oCommand.ActiveConnection = This.oConn
> This.oCommand.CommandType = 1
> ENDFUNC
>
> FUNCTION Request(nContactType)
> This.oCommand.CommandText = "Request "+ALLTRIM(STR(nContactType))
> oRec = This.oCommand.Execute
> RETURN oRec
> ENDFUNC
>
> FUNCTION GetContactTypes()
> This.oCommand.CommandText = "GetContactTypes"
> oRec = This.oCommand.Execute
> RETURN oRec
> ENDFUNC
>
> FUNCTION Release()
> oConn = .NULL.
> oCommand = .NULL.
> RELEASE oCommand, oConn
> ENDFUNC
>
>ENDDEFINE
>
>and build COM server exe.
>
>I copy it on network drive and it is regestered and Regmangr32 alows it to be remotley called.
>
>when a call an instance of this object like
>conact = CREATEOBJECT("AS.Contacts")
>it creates an object
>when I run a method like
>oRec = contact.Request(0) or
>oRec = contact.GetContactTypes()
>It works very fas an firs time but every other second time it hangs up and any when I click on foxpro window or do any activity it gives me a message "Action cannot be completed becuose other program is busy. Switch/Retry"
>It does not metter what I push it 's keep saying that, however after ~1 min it works and brings a right result. It does that only every second time.
>
>Does anybody know what is happening here?
>Thank's in advance.
Alexandre Palma
Senior Application Architect