TDolphin oServer:Query Error for Dynamic SQL

TDolphin oServer:Query Error for Dynamic SQL

Postby shri_fwh » Fri Nov 30, 2012 3: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: Select all  Expand view


#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 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: TDolphin oServer:Query Error for Dynamic SQL

Postby shri_fwh » Fri Nov 30, 2012 3: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 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: TDolphin oServer:Query Error for Dynamic SQL

Postby Daniel Garcia-Gil » Fri Nov 30, 2012 11:32 pm

Hello

try with xbrowse( oBrwItems ) to check if query is correctly fetched
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: TDolphin oServer:Query Error for Dynamic SQL

Postby shri_fwh » Sat Dec 01, 2012 7: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 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: TDolphin oServer:Query Error for Dynamic SQL

Postby shri_fwh » Sat Dec 01, 2012 3: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 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 85 guests