About unicode char fieldname and values
Posted: Sat 12 Sep 2009 04:47
my code:
procedure TForm1.Button2Click(Sender: TObject);
begin
MyQuery1.Close;
MyQuery1.SQL.Text :=
'drop table if exists `test`;' +
'CREATE TABLE `test` (' +
'`ID` int(11) unsigned NOT NULL AUTO_INCREMENT,' +
'`錦` char(50) DEFAULT NULL,' +
'PRIMARY KEY (`ID`),' +
'UNIQUE KEY `ID` (`ID`)' +
') ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=gbk;' +
'insert into `test` (`錦`) values (''錦'')';
MyQuery1.Execute;
MyQuery1.SQL.Text := 'select * from `test`';
MyQuery1.Open;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if MyQuery1.Active then
MyQuery1.Refresh
else
MyQuery1.Open;
end;
when cinnection option use unicode is true , fields valus char "" -> "?"
when cinnection option use unicode is false, field name char "" -> "?"
procedure TForm1.Button2Click(Sender: TObject);
begin
MyQuery1.Close;
MyQuery1.SQL.Text :=
'drop table if exists `test`;' +
'CREATE TABLE `test` (' +
'`ID` int(11) unsigned NOT NULL AUTO_INCREMENT,' +
'`錦` char(50) DEFAULT NULL,' +
'PRIMARY KEY (`ID`),' +
'UNIQUE KEY `ID` (`ID`)' +
') ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=gbk;' +
'insert into `test` (`錦`) values (''錦'')';
MyQuery1.Execute;
MyQuery1.SQL.Text := 'select * from `test`';
MyQuery1.Open;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if MyQuery1.Active then
MyQuery1.Refresh
else
MyQuery1.Open;
end;
when cinnection option use unicode is true , fields valus char "" -> "?"
when cinnection option use unicode is false, field name char "" -> "?"