FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TDolphin oServer:Query Error for Dynamic SQL
Posts: 336
Joined: Mon Dec 07, 2009 02:49 PM
TDolphin oServer:Query Error for Dynamic SQL
Posted: Fri Nov 30, 2012 03:13 PM
Hi ,

I am using TDolphin Lib to access MySQL DB. I am trying to populate a result set into XBROWSE via oServer:Query( ) method. I am passing the xharbour CHAR ( String ) to this Query( ) method to get result set. But one of the Column value is not correct populating actually its coming from another column. So in the XBROWSE it is not displaying correctly. But when I create the view by using same SQL Query and pass view Query as " select * from vw_1" it is displays correctly. But I want to generate SQL query at client side in the xHarbour procedure not at DB Side. Please advise on this.

in the below example Item_ID column's value display for Item_Name which is not correct.

Code (fw): Select all Collapse
#xtranslate C_VW_VOU_ITEMS_REC (<x>) => " SELECT vi.*, i.ITEM_NAME , im.ITEM_MRP , i.QTY_PER_BOX  " +;
                                        " FROM t_vou_items_d"+ oApp:gThisFY +" vi " + ;
                                        " INNER JOIN t_item_m i ON i.ITEM_ID = vi.ITEM_ID " + ;
                                        " INNER JOIN t_item_mrp_m"+ oApp:gThisFY +" im ON im.MRP_ID = vi.MRP_ID" + ;    
                                        " WHERE vi.VOU_ID = "+str( <x> )+" ORDER BY vi.SR_NO ASC "      


   oRGSItems  := oApp:gDBServer:Query(  C_VW_VOU_ITEMS_REC (0) )

    @ 375, 25 XBROWSE oBrwItems SIZE 920, 150 PIXEL OF oWnd     ;
      COLUMNS  { "MRP_ID", "ITEM_NAME"} ; 
      FONT oApp:oFontBrw1 ;
      OBJECT  oRGSItems
Thanks

Shridhar

FWH 24.04, BCC 7 32 bit, MariaDB
Posts: 336
Joined: Mon Dec 07, 2009 02:49 PM
Re: TDolphin oServer:Query Error for Dynamic SQL
Posted: Fri Nov 30, 2012 03:32 PM

Hi ,

Looks like its XBROWSE error I could see the correct value in the MsgAlert() functions for the column (ITEM_NAME) it shows correctly.

Thanks
Shridhar

Thanks

Shridhar

FWH 24.04, BCC 7 32 bit, MariaDB
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: TDolphin oServer:Query Error for Dynamic SQL
Posted: Fri Nov 30, 2012 11:32 PM

Hello

try with xbrowse( oBrwItems ) to check if query is correctly fetched

Posts: 336
Joined: Mon Dec 07, 2009 02:49 PM
Re: TDolphin oServer:Query Error for Dynamic SQL
Posted: Sat Dec 01, 2012 07:34 AM
Hi Daniel ,

Yes It is showing correctly. The given below record is extracted to Excel and its is correct. But why the same Item Name is not showing correctly in @ XBROWSE command? Could you please advise me. Thanks in advance..!

Record:
Item Name : AMERICAN MANGO 180 ML



Thanks
Shridhar
Thanks

Shridhar

FWH 24.04, BCC 7 32 bit, MariaDB
Posts: 336
Joined: Mon Dec 07, 2009 02:49 PM
Re: TDolphin oServer:Query Error for Dynamic SQL
Posted: Sat Dec 01, 2012 03:37 PM
Hi Daniel ,

In my further investigation I found that the calling :SetWhere method is might be the cause for the Error but I am not sure. The first time its shows the correct value for the column (without calling SetWhere Method) but, next time when :SetWhere method is called the result set does not populate correctly and it show wrong value for the column. I checked also the samples which are supplied with TDolphin lib in that, the Query is written with table name and for column also the same table is used for e.g. student.student_id . But in my Query I am using table alias.I believe that the alias names will not allow/work in the SetWhere Method. Please guide me on this.

Thanks
Shridhar
Thanks

Shridhar

FWH 24.04, BCC 7 32 bit, MariaDB

Continue the discussion