Delphi7问题点总结一(持续更新中)

来源:互联网 发布:手机论坛 小程序 源码 编辑:程序博客网 时间:2024/05/21 13:59

1.在使用ADO组件将数据保存到SQL Server 2005时,遇到中文字体无法插入的情况。在Delphi7中报“application uses a value of the wrong type for the current operation”错误,这是因为在ADO组件在处理汉字时,默认类型设置不对,需要重新设置数据类型。例如:

Parameters.ParamByName('CarType').DataType := ftWideString;


 2.在使用ADO组件保存数据时,Delphi7报“Parameter object is improperly defiend.Inconsisten or incomplete information was provided”,表示在我们写的SQL语句中,有些参数没有赋值;

3.“In Compatible types'string' and 'TString' Field definition not allowed after metheds or properties”这种错误经常出现在我们使用SQL.ADD添加sql语句上。遇到这种情况,需要将SQL.ADD换成SQL.Text即可。

4.“Unable to invoke Code Completion due to errors in source code”,这是因为在.pas文件中存在delphi 无法识别的编码,也就是说.pas文件中的字符并非是纯粹的可由文本文件编辑器所能识别的编码。所以,delphi就不可能有效地解释这些编码。因而就出现了自动代码提示功能失效的错误。将.pas文件拷贝到ultraEdit中,用文件菜单下的转换功能,即 utf 8 转ascii,去除 显示?好的地方。再复制出文本拷贝回delphi中即可解决问题。

5.利用TClientDataSet组件来自动生成字段:1.需要将DataSetProvider绑定到TClientDataSet;2.将DataSetProvider中Option的poAllowColumn属性修改为true;3.在调用TClientDataSet时调用CreateDataSet方法。

 

 

原创粉丝点击