MyQuery.Edit metod raises an exception

MyQuery.Edit metod raises an exception

Postby guest » Tue 19 Jul 2005 20:59

I've upgraded my old version MyDac to ver. 3.55.0.22 and find out this problem, when i'm trying to update old field with field which contain '&' simbol, MyQuery.Edit metod raises an exception.

strquery := 'UPDATE testtable SET TESTFIELD = "Field with & simbol" ';

MyQuery.SQLUpdate.Clear;
MyQuery.SQLUpdate.Add(strquery);

try
MyQuery.Edit;
MyQuery.ApplyUpdates;
except
end;
It works on my old version.

Best regards.
guest
 

Postby Ikar » Wed 20 Jul 2005 14:07

> It works on my old version.

What version have you used previously?

> MyQuery.Edit metod raises an exception.

Please specify what error message you have.

We couldn't reproduce the problem.
Please send us complete small sample to demonstrate it and include script to create and fill testtable .
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Postby Guest » Wed 20 Jul 2005 17:38

>What version have you used previously?
i used MyDAC 2.00.3.1

I'm sorry i was wrong, Edit method works fine
but after MyQuery1.SQLUpdate.Add() method MyQuery1.Active property becomes False if new field contains "&" symbol

unit UTest;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, Grids, DBGrids, MemDS, DBAccess, MyAccess;

type
TForm1 = class(TForm)
MyConnection1: TMyConnection;
MyQuery1: TMyQuery;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormShow(Sender: TObject);
begin
MyQuery1.SQL.Clear;
MyQuery1.SQL.Add('SELECT * FROM testtable');
MyQuery1.Open;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
strquery : string;
begin
strquery := Format('UPDATE testtable SET TESTFIELD = "Test&&&" WHERE RECNUM = "%d"', [MyQuery1.FieldByName('RECNUM').AsInteger]);
MyQuery1.SQLUpdate.Clear;
MyQuery1.SQLUpdate.Add(strquery);
{
After executing MyQuery1.SQLUpdate.Add method MyQuery1.active property = False.
It occurs only if new field contains '&' symbol otherwise MyQuery1.active remains TRUE
}
MyQuery1.Edit;
MyQuery1.ApplyUpdates;
MyQuery1.Refresh;
end;


end.
#
# Table structure for table `testtable`
#
CREATE TABLE `testtable` (
`RECNUM` double NOT NULL auto_increment,
`TESTFIELD` varchar(50) NOT NULL default '',
PRIMARY KEY (`RECNUM`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;
#
# Dumping data for table `testtable`
#
INSERT INTO `testtable` VALUES ('1', 'Test&&&&&');
Guest
 

Postby Ikar » Thu 21 Jul 2005 11:29

Thank you for information.
We reproduced your problem and fixed it. This fix will be included in the next MyDAC build. It will be vailable in about two weeks. Please look forward for announcments at the forum
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56


Return to MySQL Data Access Components