|
-
May 3rd, 2008, 06:42 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] [DELPHI] Cannot save to SQLITE database when user types in special characters
When the user types special characters such as quotation marks or commas in an EditBox, the record cannot be saved since those characters interfere with the SQL code.
Is there any way I can modify the code below so as to prevent the special characters typed by the user from interfering with the Save procedure?
Code:
procedure TfrmArchivio.InsertText;
var
sSQL: String;
begin
sl3db.BeginTransaction;
sSQL := 'INSERT INTO lavoratori(ID,varNome,varIndirizzo,varCap,varCitta,varProv,varDataNasc,varLuogoNasc,';
sSQL := sSQL + 'varContratto,varPrestazione,varAssunzione,varCessazione,varCompenso,varProtocollo,varCodFisc,';
sSQL := sSQL + 'varIva,varTelCasa,varTelUff,varTelCel,varFax,varEmail,varNote,Ext)';
sSQL := sSQL + ' VALUES (NULL,"' + Trim(txtNome.Text) + '","' + Trim(txtIndirizzo.Text) + '","' + Trim(txtCap.Text) + '","';
sSQL := sSQL + Trim(txtCitta.Text) + '","' + Trim(txtProv.Text) + '","' + Trim(txtDataNasc.Text) + '","';
sSQL := sSQL + Trim(txtLuogoNasc.Text) + '","' + Trim(txtContratto.Text) + '","' + Trim(txtPrestazione.Text) + '","';
sSQL := sSQL + Trim(txtAssunzione.Text) + '","' + Trim(txtCessazione.Text) + '","' + Trim(txtCompenso.Text) + '","';
sSQL := sSQL + Trim(txtProtocollo.Text) + '","' + Trim(txtCodFisc.Text) + '","' + Trim(txtIva.Text) + '","';
sSQL := sSQL + Trim(txtTelCasa.Text) + '","' + Trim(txtTelUff.Text) + '","' + Trim(txtTelCel.Text) + '","';
sSQL := sSQL + Trim(txtFax.Text) + '","' + Trim(txtEmail.Text) + '","' + Trim(txtNote.Text) + '","JPG");';
sl3db.ExecSQL(sSQL);
sl3db.Commit;
end;
Thanks in advance.
Last edited by esposito; May 4th, 2008 at 01:28 AM.
Since I discovered Delphi and Lazarus, VB has become history to me.
-
May 7th, 2008, 02:42 PM
#2
Thread Starter
Fanatic Member
Re: [DELPHI] Cannot save to SQLITE database when user types in special characters
Resolved thanks to another forum.
Thank you anyway.
Since I discovered Delphi and Lazarus, VB has become history to me.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|