Mr. Rao, Where's the difference?

Mr. Rao, Where's the difference?

Postby Armando » Fri Feb 26, 2021 2:40 am

Mr. Rao:

I have these two pieces of code

Code: Select all  Expand view

   TRY
      oRsVia  :=  TOleAuto():New("adodb.recordset")
   CATCH oError
      MsgStop( "No se ha podido crear el RECORDSET de Viajes !", oApp:cAplicacion)
      FW_ShowAdoError(oApp:oCon)
      RETURN(.F.)
   END

   oRsVia:CursorLocation   := adUseClient
   oRsVia:LockType         := adLockOptimistic
   oRsVia:CursorType       := adOpenDynamic
   oRsVia:Source           := "SELECT " +;
                                 "*," +;
                                 "TIP_NOM," +;
                                 "TIP_COP," +;
                                 "MAT_DES," +;
                                 "CLI_NOM," +;
                                 "CLI_ALI," +;
                                 "ORI_NOM," +;
                                 "DES_NOM," +;
                                 "OPE_UNI," +;
                                 "OPE_NOM," +;
                                 "UNI_DES," +;
                                 "FOR_DES " +;
                              "FROM " +;
                                 "Viajes " +;
                              "LEFT JOIN " +;
                                 "Tipos " +;
                              "ON " +;
                                 "VIA_TIP = Tipos.TIP_TIP " +;
                              "LEFT JOIN " +;
                                 "Materiales " +;
                              "ON " +;
                                 "VIA_MAT = Materiales.MAT_MAT " +;
                              "LEFT JOIN " +;
                                 "Clientes " +;
                              "ON " +;
                                 "VIA_CLI = Clientes.CLI_CLI " +;
                              "LEFT JOIN " +;
                                 "Origenes " +;
                              "ON " +;
                                 "VIA_ORI = Origenes.ORI_ORI " +;
                              "LEFT JOIN " +;
                                 "Destinos " +;
                              "ON " +;
                                 "VIA_DES = Destinos.DES_DES " +;
                              "LEFT JOIN " +;
                                 "Operadores " +;
                              "ON " +;
                                 "VIA_OPE = Operadores.OPE_OPE " +;
                              "LEFT JOIN " +;
                                 "Unidades " +;
                              "ON " +;
                                 "OPE_UNI = Unidades.UNI_NUM " +;
                              "LEFT JOIN " +;
                                 "Formas " +;
                              "ON " +;
                                 "VIA_FOR = Formas.FOR_FOR " +;
                              "WHERE " +;
                                 "VIA_FDV = '" + DTOS(dHoy) + "' " +;
                              "ORDER BY " +;
                                 "VIA_FOL"

   TRY
      oRsVia:Open(oRsVia:Source,oApp:oCon)
   CATCH oError
      MsgStop( "No se ha podido abrir el RECORDSET de Viajes !", oApp:cAplicacion)
      FW_ShowAdoError(oApp:oCon)
      RETURN(.F.)
   END
 


Image

Code: Select all  Expand view

   oRsVia := FW_OpenRecordSet(oApp:oCon,"SELECT " +;
                                          "*," +;
                                          "TIP_NOM," +;
                                          "TIP_COP," +;
                                          "MAT_DES," +;
                                          "CLI_NOM," +;
                                          "CLI_ALI," +;
                                          "ORI_NOM," +;
                                          "DES_NOM," +;
                                          "OPE_UNI," +;
                                          "OPE_NOM," +;
                                          "UNI_DES," +;
                                          "FOR_DES " +;
                                       "FROM " +;
                                          "Viajes " +;
                                       "LEFT JOIN " +;
                                          "Tipos " +;
                                       "ON " +;
                                          "VIA_TIP = Tipos.TIP_TIP " +;
                                       "LEFT JOIN " +;
                                          "Materiales " +;
                                       "ON " +;
                                          "VIA_MAT = Materiales.MAT_MAT " +;
                                       "LEFT JOIN " +;
                                          "Clientes " +;
                                       "ON " +;
                                          "VIA_CLI = Clientes.CLI_CLI " +;
                                       "LEFT JOIN " +;
                                          "Origenes " +;
                                       "ON " +;
                                          "VIA_ORI = Origenes.ORI_ORI " +;
                                       "LEFT JOIN " +;
                                          "Destinos " +;
                                       "ON " +;
                                          "VIA_DES = Destinos.DES_DES " +;
                                       "LEFT JOIN " +;
                                          "Operadores " +;
                                       "ON " +;
                                          "VIA_OPE = Operadores.OPE_OPE " +;
                                       "LEFT JOIN " +;
                                          "Unidades " +;
                                       "ON " +;
                                          "OPE_UNI = Unidades.UNI_NUM " +;
                                       "LEFT JOIN " +;
                                          "Formas " +;
                                       "ON " +;
                                          "VIA_FOR = Formas.FOR_FOR " +;
                                       "WHERE " +;
                                          "VIA_FDV = '" + DTOS(dHoy) + "' " +;
                                       "ORDER BY " +;
                                          "VIA_FOL",adLockOptimistic,adOpenDynamic,0)

   IF oRsVia == nil
        MsgStop("No pude abrir la tabla VIAJES !",oApp:cAplicacion)
      FW_ShowAdoError(oApp:oCon)
      RETURN(.F.)
   ENDIF
 


Image


They both do the same thing, create and open a record set and show it on a xbrowse
The first one works very well and shows the xbrowse but the second one does not show
the xbrowse, it does not send error, it just does not show the xbrowse

Do you have any clue?

Best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3176
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Mr. Rao, Where's the difference?

Postby nageswaragunupudi » Sat Feb 27, 2021 11:25 am

Can you execute this and let me know the result?
Code: Select all  Expand view

? oApp:oCon:CursorLocation
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10465
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Mr. Rao, Where's the difference?

Postby Armando » Sat Feb 27, 2021 4:54 pm

Mr. Rao:

It shows the number 2

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3176
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Mr. Rao, Where's the difference?

Postby nageswaragunupudi » Sun Feb 28, 2021 4:15 am

Can you please set
Code: Select all  Expand view

oApp:oCn:CursorLocation := 3

and then try FW_OpenRecordSet(...)
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10465
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 76 guests