if Trim(ComboBox9.Text) <> '' then
with DM1.ADOQ0 do
try
//是否已经存在
Close;
SQL.Clear;
SQL.Add('select count(*) from marry.dbo.dictionary where id = 17 and ltrim(rtrim(name)) = ''' + Trim(ComboBox9.Text) + '''');
Open;
//
if Fields.Fields[0].AsInteger = 0 then
begin
//统计现有会员性格的条目数量 tx_num
Close;
SQL.Clear;
SQL.Add('select count(*) from marry.dbo.dictionary where id = 17');
Open;
xg_num := Fields.Fields[0].AsInteger;
//插入输入的会员性格
Close;
SQL.Clear;
SQL.Add('insert into marry.dbo.dictionary values(17,' + InttoStr(xg_num) + ',''' + Trim(ComboBox9.Text) + ''')');
ExecSQL;
//添加
ComboBox9.Items.Add(Trim(ComboBox9.Text));
ComboBox21.Items.Add(Trim(ComboBox9.Text));
ComboBox9.ItemIndex := xg_num;
end
except
Application.MessageBox('处理会员性格失败!!','警告',MB_OK);
exit;
end