Problems with an application using ADO

Re: Problems with an application using ADO

Postby Rick Lipkin » Sat Jun 08, 2013 1:44 pm

Antonio

Here is how I create an Ado recordset on demand ..

Rick Lipkin

Code: Select all  Expand view


Func Main()

Local cFile,aDir,nStart,cDefa,xProvider,xSource
Public xDatabase,xConnect

/-- get timestamp on .exe //

cFILE := GetModuleFileName( GetInstance() )
aDIR  := DIRECTORY( cFILE )

// where .exe started from is default directory //

nSTART := RAT( "\", cFILE )
cDEFA  := SUBSTR(cFILE,1,nSTART-1)

aDIR   := NIL

SET DEFA to ( cDEFA )


xDATABASE := "
A"      // access
// xDATABASE := "
S"   // sql server
// xCATALOG  := "
SERVICE"
// xUSERID   := "
serviceuser"

xPROVIDER := "
Microsoft.Jet.OLEDB.4.0"
xSOURCE   := cDEFA+"
\Groom.mdb"
xPASSWORD := "
password"

IF xDATABASE = "
A"
   xCONNECT := 'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Jet OLEDB:Database Password='+xPASSWORD
ELSE
   xCONNECT := 'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Initial Catalog='+xCATALOG+';User Id='+xUSERID+';Password='+xPASSWORD
ENDIF

REQUEST DBFCDX
rddsetdefault ( "
DBFCDX" )

...
...

// open a recordset on demand with sql statement and connection string

oRsUser := TOleAuto():New( "
ADODB.Recordset" )
oRsUser:CursorType     := 1        // opendkeyset
oRsUser:CursorLocation := 3        // local cache
oRsUser:LockType       := 3        // lockoportunistic

cSQL := "
SELECT * From [Staff] Order by [Lname]"

TRY
  oRsUser:Open(cSQL,xCONNECT )
CATCH oErr
  MsgInfo( "
Error in Opening Staff table" )
  RETURN(.F.)
END TRY

xbrowse( oRsUser )
oRsUser:CLose()
oRsUser := nil

User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Problems with an application using ADO

Postby Antonio Linares » Sat Jun 08, 2013 7:05 pm

Enrico,

Also Rick suggestion for not having opened connections seems very interesting.

I already use that.


Would you mind to post an example of how you do it ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problems with an application using ADO

Postby Rick Lipkin » Sat Jun 08, 2013 7:27 pm

Antonio

Notice in my post the variable xConnect .. just a connection string .. Pass that to oRsUser:Open(cSQL,xCONNECT ) and you have a fetch of rows on demand .. no need to create and pass an ( active ) connection.

Rick Lipkin
ps .. Enrico shared this ( type of ) example with me several years ago when I was just a 'padawan learner' struggling with ADO :D
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Problems with an application using ADO

Postby Enrico Maria Giordano » Sat Jun 08, 2013 7:39 pm

Antonio,

Antonio Linares wrote:Enrico,

Also Rick suggestion for not having opened connections seems very interesting.

I already use that.


Would you mind to post an example of how you do it ? thanks


As for Rick sample. :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Problems with an application using ADO

Postby Antonio Linares » Sat Jun 08, 2013 8:54 pm

Enrico,

ok, I missed it, thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problems with an application using ADO

Postby elvira » Mon Jun 10, 2013 5:34 pm

Enrico,

Any news?.

Thank you.
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: Problems with an application using ADO

Postby Enrico Maria Giordano » Mon Jun 10, 2013 5:36 pm

Elvira and Antonio,

elvira wrote:Enrico,

Any news?.

Thank you.


It seems that the problem started after the installation of FWH 13.04.

Any ideas?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Problems with an application using ADO

Postby Enrico Maria Giordano » Mon Jun 10, 2013 5:42 pm

I just get the notice from my client that the problem is not with ADO but with DBF also. :-(

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Problems with an application using ADO

Postby Enrico Maria Giordano » Mon Jun 10, 2013 5:51 pm

Probably it means nothing for this problem but in tmsgitem.prg there are two different definition for the method Refresh.

Antonio, can you check it, please?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Problems with an application using ADO

Postby James Bott » Mon Jun 10, 2013 6:36 pm

I just get the notice from my client that the problem is not with ADO but with DBF also.


Maybe this is more evidence that it might be a memory leak in the app.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Problems with an application using ADO

Postby Enrico Maria Giordano » Mon Jun 10, 2013 7:51 pm

James,

James Bott wrote:
I just get the notice from my client that the problem is not with ADO but with DBF also.


Maybe this is more evidence that it might be a memory leak in the app.

James


No, the problem is not in the applications. They worked fine before the last FWH update.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Problems with an application using ADO

Postby James Bott » Mon Jun 10, 2013 8:16 pm

No, the problem is not in the applications. They worked fine before the last FWH update.


It still could be that either FWH or (x)Harbour introduced a memory leak with the last update.

james
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Problems with an application using ADO

Postby lucasdebeltran » Mon Jun 10, 2013 8:38 pm

Hello,

I confirm you the problem with DBF and FW 13.05.

It was not in previous build, so it is related with MsgBar or changes in TControl/TWindow as a result of a post from Antonio´s at Harbour Developers list.

It is quite urgent.

It happens when you have the main window open with no activity in 15-20 minutes.

Best regards
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: Problems with an application using ADO

Postby Enrico Maria Giordano » Mon Jun 10, 2013 9:27 pm

James,

James Bott wrote:
No, the problem is not in the applications. They worked fine before the last FWH update.


It still could be that either FWH or (x)Harbour introduced a memory leak with the last update.

james


Yes, I agree.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Problems with an application using ADO

Postby Enrico Maria Giordano » Mon Jun 10, 2013 9:29 pm

Lucas,

lucasdebeltran wrote:I confirm you the problem with DBF and FW 13.05.


Thank you.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 62 guests