Summary of UNDAC control connection MySQL database in Delphi

Source: Internet
Author: User

1, the database hangs on the Cxgrid, the Chinese display is not correct

I have been debugging for a long time, suspicion is the coding problem, MySQL encoding method I have tried, can not.
Problem Solving Process:
(1), in the DOS system into the MySQL database input show variables like ' char% ';

I thought it might be that Character_set_connection's coding was problematic, so I started to set it up, but the encoding method was to restart the database or the original encoding. Of course you can set the MySQL database configuration file, but this is not the reason.
(2), considering the possibility of the database character set encoding method, the use of Heidisql software conversion encoding.

In fact, MySQL is usually used UTF8 code, do not change, so failed.
(3), a different angle, if it is not the problem of MySQL is the UNDAC control problem, what is the control it? Of course, from the connection database control began to look for.

Double-click it,
Choose options, inside the first charset set to GB2312, so it's done.
The Cxgrid kanji display solved.

2. Execute MySQL database statement using UNDAC

The following sentence is executed with the UNDAC control, which reports a syntax error.
Error type 1:unknown column ' rownum ' in ' WHERE clause '
Error type 2: #42S22Unknown column ' 2005 '

update tb_zichan set Logliushui="20150318",JieChuRen="李二狗",JieChuRenDianHua="18791983947",JieChuWeiZhi="537",YuGuiHuanShiJian="2015-03-18",JingShouRen="糖糖",JieChuShiJian="2015-04-28 18:33:42",JieChuRenEMail="",JieChuZhuangTai="借出" where SheBeiBianHao="20050408"。

Tried several times, and finally found that the original UNDAC control to execute the MySQL statement, string fields cannot be double quotes, can only use single quotation marks. For example, the following statement.

UPDATE tb_zichan SET Logliushui =‘20150318‘,JieChuRen =‘人‘,JieChuRenDianHua =‘18791983947‘,JieChuWeiZhi =‘537‘,YuGuiHuanShiJian =‘2015-03-18‘,JingShouRen =‘dhfjh‘,JieChuShiJian =‘2015-04-28 18:33:42‘,JieChuRenEMail =‘‘,JieChuZhuangTai =‘hfudgf‘ where SheBeiBianHao =‘20050408‘
3, determine whether the data in the MySQL database table is empty, or set a field data is empty as the following statement
UPDATE tb_zichan SET Logliushui =‘20150318‘,JieChuRen =‘人‘,JieChuRenDianHua =null,JieChuWeiZhi =‘537‘,YuGuiHuanShiJian =‘2015-03-18‘,JingShouRen =‘dhfjh‘,JieChuShiJian =‘2015-04-28 18:33:42‘,JieChuRenEMail =‘‘,JieChuZhuangTai =‘hfudgf‘ where SheBeiBianHao is null
4. If a field type mismatch error is encountered in the table

If you change the field type in the database when you use the database, the table in the run UNDAC does not match the field in the report to the database field.
The fields in the table in UNDAC are usually opened by double-clicking it, deleting all of them, and then joining the database to add all the fields again.

Summary of UNDAC control connection MySQL database in Delphi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.