Jump to content
Fórum Script Brasil
  • 0

(Resolvido) Gravando dados do formulario


Creedence
 Share

Question

Bo, dia !

 

Tenho um formulário com botão gravar e no click desse botão, tenho o código abaixo para inserir novo registro na tabela:

 

   ADOQuery1.Close;
   ADOQuery1.SQL.Add('INSERT INTO tbclientes (cliempresa) VALUES (edtempresacli.text)');
   ADOQuery1.ExecSQL;
   ShowMessage('Registros gravados !!!');
 
Estou testando apenas um campo pra ver se funciona. Dá erro de "Parametros insuficientes. Eram esperados 1".
Se eu coloco aspas no values também dá erro de aspas.
 
Obrigado,
 
Marcos
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Tente dessas maneiras:

ADOQuery1.Close;

ADOQuery1.SQL.Clear;

ADOQuery1.SQL.Add('insert into tbclientes (cliempresa) values ('+ edtempresacli.text +' ));

ADOQuery1.ExecSQL;

==========================================================================

ADOQuery1.Close;

ADOQuery1.SQL.Clear;

ADOQuery1.SQL.Add(Format('insert into tbclientes (cliempresa) values (%s)',[QuotedStr( edtempresacli.text )]));

ADOQuery1.ExecSQL;

==========================================================================

ADOQuery1.Close;

ADOQuery1.SQL.Clear;

ADOQuery1.SQL.Add('INSERT INTO  tbclientes  (cliempresa) VALUES (:a)');

ADOQuery1.Parameters.ParamByName('a').Value :=  edtempresacli.text ;

ADOQuery1.ExecSQL;

 

abraço

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.1k
×
×
  • Create New...