ERROR FWMARIADB, Mr. Rao. URGENTE!

ERROR FWMARIADB, Mr. Rao. URGENTE!

Postby Ariel » Tue Aug 11, 2020 8:46 pm

Mr. Rao,
si hago esto :
Code: Select all  Expand view

             acTable[1]:= "temp10"              //+ALLTRIM(STR(INT(Seconds()),7))

    ::oServer:Execute( "DROP TABLE IF EXISTS "+acTable[1] )
         
    cQuery:= "CREATE TEMPORARY TABLE "+acTable[1]+" "+;
                     "(id int(11) NOT NULL auto_increment, "+;
                     "fecha date DEFAULT NULL, "+;
                     "comprobante varchar(20), "+;
                     "codcli double(6,0),  "+;
                     "lista double(2,0),   "+;
                     "cantid double(10,3), "+;
                     "kilos double(10,3),  "+;
                     "precio double(12,2), "+;
                     "bonifi double(6,2),  "+;
                     "importe double(12,2), "+;
                     "codven double(4,0), "+;
                     "codart varchar(20), "+;
                     "PRIMARY KEY  (`id`), "+;
                     "UNIQUE KEY `id` (`id`) ) "
    ::oServer:Execute( cQuery )
 


cuando hago un INSERT no me hace nada y es porque la tabla no existe.

Gracias.
Ariel
 
Posts: 374
Joined: Wed Nov 29, 2006 1:51 pm
Location: Rosario - Argentina

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Postby cjcardoza » Wed Aug 12, 2020 6:05 pm

Utilizo lo siguiente sin inconvenientes
::oServer:SqlQuery(cQuery )
cjcardoza
 
Posts: 31
Joined: Thu Jul 13, 2006 12:20 am
Location: Lima - Peru

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Postby nageswaragunupudi » Thu Aug 13, 2020 6:23 am

Please use
::oServer:Execute( "INSERT INTO ....." )
Regards

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

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Postby Ariel » Thu Aug 13, 2020 10:47 am

Mr. RAo,
gracias por responder, pero NO puedo hacer un INSERT porque NO me crea la tabla temporal, ese es el problema que le panteo.
Gracias.
Ariel
 
Posts: 374
Joined: Wed Nov 29, 2006 1:51 pm
Location: Rosario - Argentina

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Postby nageswaragunupudi » Fri Aug 14, 2020 4:05 pm

Your queries are working successfully when I tested here.
This is the test program. I used FWH Cloud server. You can build this sample on your computer and run it.

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local acTable[ 1 ], cQuery, oRs, cSql
   local oServer

   SET DATE BRITISH
   SET CENTURY ON

   oServer  := FW_DemoDB( 6 )

   acTable[1]:= "temp10"              //+ALLTRIM(STR(INT(Seconds()),7))

   oServer:Execute( "DROP TABLE IF EXISTS "+acTable[1] )

   cQuery:= "CREATE TEMPORARY TABLE "+acTable[1]+" "+;
             "(id int(11) NOT NULL auto_increment, "+;
             "fecha date DEFAULT NULL, "+;
             "comprobante varchar(20), "+;
             "codcli double(6,0),  "+;
             "lista double(2,0),   "+;
             "cantid double(10,3), "+;
             "kilos double(10,3),  "+;
             "precio double(12,2), "+;
             "bonifi double(6,2),  "+;
             "importe double(12,2), "+;
             "codven double(4,0), "+;
             "codart varchar(20), "+;
             "PRIMARY KEY  (`id`), "+;
             "UNIQUE KEY `id` (`id`) ) "

   oServer:Execute( cQuery )

   cQuery   := "INSERT INTO " + acTable[ 1 ] + ;
               " ( fecha,comprobante,codcli,lista ) VALUES ( " + ;
               "'2000-10-20', 'first record', 65400, 6 )"

   oServer:Execute( cQuery )

   oRs   := oServer:RowSet( "select * from " + acTable[ 1 ] )

   oRs:Edit()
   oRs:Browse()

   oRs:Close()
   oServer:Close()

return nil
 


Image

Image
Regards

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

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Postby nageswaragunupudi » Fri Aug 14, 2020 4:10 pm

However, we recommend you taking full advantage of FWH Marialib methods.
Please try this sample to achieve the same results, but this approach removes the complexity of writing our own queries.

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oCn, oRs, cSql, cTable

   SET DATE BRITISH
   SET CENTURY ON

   oCn      := FW_DemoDB( 6 )
   cTable   := "temp10"

   oCn:Execute( "DROP TABLE IF EXISTS " + cTable )
   oCn:CreateTable( "TEMPORARY " + cTable, ;
      {  { "fecha",        "D",  8,    0  } ;
      ,  { "comprobante",  "C", 20,    0  } ;
      ,  { "codcli",       "N",  6,    0  } ;
      ,  { "lista",        "N",  2,    0  } ;
      ,  { "candid",       "N", 10,    3  } ;
      ,  { "kilos",        "N", 10,    3  } ;
      ,  { "precio",       "N", 12,    2  } ;
      ,  { "bonifi",       "N",  6,    2  } ;
      ,  { "importe",      "N", 12,    2  } ;
      ,  { "codven",       "N",  4,    0  } ;
      ,  { "codart",       "C", 20,    0  } ;
      } )

   cSql  := oCn:InsertSQL( cTable, "fecha,comprobante,codcli", ;
                  { Date(), "First Record", 65400, 6 } ) // Array with Harbour variables/constants
   oCn:Execute( cSql )

   oRs   := oCn:RowSet( "select * from " + cTable )

   oRs:Edit()
   oRs:Browse()

   oRs:Close()
   oCn:Close()

return nil
 
Regards

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

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Postby Ariel » Sun Aug 16, 2020 11:50 am

Mr. Rao,

muchas gracias, funcionó perfecto.

Saludos
Ariel
 
Posts: 374
Joined: Wed Nov 29, 2006 1:51 pm
Location: Rosario - Argentina


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Horizon and 32 guests