I'm using ZEOSDBO-7.0.3-stable. I got this exception occasionally when inserting values using TZQuery, but other function using similar syntax just fine. so i doing some testing today, and come up something wrong in SetStatementParams().
is something wrong with this code?
Code: Select all
Parameter := TStringList.Create;
Parameter.Delimiter := ';';
Parameter.QuoteChar := '"';
Parameter.Add('PARAM1='+param1);
Parameter.Add('PARAM2='+param2);
Parameter.Add('PARAM3='+param3);
Parameter.Add('PARAM4='+param4);
Parameter.Add('PARAM5='+param5);
MyQuery := TZQuery.Create(nil);
MyQuery.Connection := MainForm.ConnectSQL;
try
SQL := 'INSERT INTO test_table0 (param1, param2, param3, param4, param5, param6, param7, param8, param9) VALUES '+
'(:param1, :param2, :param3, :param4, :param5, :param6, :param7, :param8, :param9)';
MyQuery.SQL.Text := SQL;
MyQuery.ParamByName('param1').AsString := param1;
MyQuery.ParamByName('param2').AsString := param2;
MyQuery.ParamByName('param3').AsString := param3;
MyQuery.ParamByName('param4').AsString := param4;
MyQuery.ParamByName('param5').AsString := param5;
MyQuery.ParamByName('param6').AsString := param6;
MyQuery.ParamByName('param7').AsString := param7;
MyQuery.ParamByName('param8').AsString := param8;
MyQuery.ParamByName('param9').AsString := param9;
MyQuery.ExecSQL;
finally
MyQuery.Close;
MyQuery.Free;
end;
Parameter.Clear;
Parameter.Free;
thanks in advance