Programming => Databases => Topic started by: eldonfsr on May 16, 2021, 12:23:00 am

Title: TZMSQL insert record
Post by: eldonfsr on May 16, 2021, 12:23:00 am
Hi i just started to test tzmsql  i write a file called database.csv it contains 3 fields  nombrecia;direccion;database

i write one record   sarusa;andaros ; test

i con open this file but i can not add new records

      query:='INSERT INTO databases.csv (nombrecia ,direccion , dbasename) VALUES ('''+ENom.Text+''' ,'''+ EDir.Text+''' , '''+ EDb.Text+''');'; 

how i can update file

Title: Re: TZMSQL insert record
Post by: eldonfsr on May 18, 2021, 07:49:38 pm
Some confuse if use this command don't work

   ZMQDSC.SQL.Text:='INSERT INTO databases.csv ( nombrecia , direccion, dbasename)'+' VALUES( '' SMAC'',''5807'',''smac'''+');';

but i use command like this works
      FormMain.ZMQDSC.FieldByName('NOMBRECIA').AsString:= 'TEST';
      FormMain.ZMQDSC.FieldByName('DIRECCION').AsString:='cONOCIDO 244';

     with las code only i can not delete but update and insert work

some body has experience with this component can help help me please..

Title: Re: TZMSQL insert record
Post by: eldonfsr on May 19, 2021, 02:20:39 am
after testing and practicing

what was my error
 the correct command is like this
   ZMQDSEdos.SQL.Text:='CREATE TABLE states (idedo, nombre) ; COMMIT)';

and now we can insert records
  ZMQDSC.SQL.Text:='INSERT INTO databases ( numero ,nombrecia , direccion, dbasename)'+' VALUES( ''0'','' test1'',''5807'',''testing'''+'); COMMIT';

and delete records like this

  FormMain.ZMQDSEdos.SQL.Text:='Delete from states where idedo <> '''+'''; COMMIT';

first step is connect ZMC connection to folder witch one is going to keep tables like this
   path = path  := GetCurrentDir();

Hope help to some body...

TinyPortal © 2005-2018