ERROR FWMARIADB, Mr. Rao. URGENTE!

Post Reply
Ariel
Posts: 309
Joined: Wed Nov 29, 2006 1:51 pm
Location: Rosario - Argentina

ERROR FWMARIADB, Mr. Rao. URGENTE!

Post by Ariel »

Mr. Rao,
si hago esto :

Code: Select all

             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.
cjcardoza
Posts: 19
Joined: Thu Jul 13, 2006 12:20 am
Location: Lima - Peru

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Post by cjcardoza »

Utilizo lo siguiente sin inconvenientes
::oServer:SqlQuery(cQuery )
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Post by nageswaragunupudi »

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

G. N. Rao.
Hyderabad, India
Ariel
Posts: 309
Joined: Wed Nov 29, 2006 1:51 pm
Location: Rosario - Argentina

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Post by Ariel »

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.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Post by nageswaragunupudi »

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

#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: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Post by nageswaragunupudi »

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

#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
Ariel
Posts: 309
Joined: Wed Nov 29, 2006 1:51 pm
Location: Rosario - Argentina

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Post by Ariel »

Mr. Rao,

muchas gracias, funcionó perfecto.

Saludos
Post Reply