GPF when using todbc

GPF when using todbc

Postby PeterHarmes » Mon Dec 08, 2008 10:37 am

Hi,

When trying to open a Sage file using todbc i'm getting a GPF when calling :open() command. Here is a cut-down version of the code that i'm using:

Code: Select all  Expand view
oOdbc := TOdbc():New(cDsn, cName, cPass)

   If !oOdbc:lSuccess
      oOdbc:ShowErrorList("ODBC session not successfully initialized, aborting...")
      oOdbc:End()
      retu nil
   Endif
   
   oDbf := oOdbc:Query( "SELECT * FROM " + cTable )
   oDbf:lDateAsStr := .t.
   oDbf:Open()
   oDbf:Complete()


Any ideas why i'm getting the gpf?

Thanks in advance

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Postby James Bott » Mon Dec 08, 2008 1:13 pm

Pete,

I have never used these classes, but I note that the oDBF:open() method is trying to create a DBF. This might fail if the user doesn't have the proper rights.

If that isn't the problem, then I suggest compiling the TDBODBC.PRG and linking it into your program. This way you can put msgInfo()'s into the Open method until you find the exact line that is causing the GPF.

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

Postby PeterHarmes » Mon Dec 08, 2008 2:19 pm

I think the problem is due to the number of fields in the table that i'm opening (141 fields) - if i just select the first field, my routine works. So is there a limit to the size of fields in a table?
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Postby James Bott » Mon Dec 08, 2008 2:28 pm

Peter,

141 fields shouldn't be a problem. Perhaps there is an unsupported datatype field?

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

Postby PeterHarmes » Mon Dec 08, 2008 2:31 pm

Thats possible i suppose - the trouble is that its hard to find the field types from sage.
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Postby Antonio Linares » Mon Dec 08, 2008 8:53 pm

Peter,

Better use ADO. There are many ADO examples in these forums.
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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 101 guests