access violation at address的问题

doubagui 2016-07-07 04:45:12

当程序执行这if (DBGrideh1.DataSource.DataSet.FindField('sslm').AsString ='1' ) then句时出现错误:

access violation at address 05501E56 in module ‘mmst.exe’ read of address 00000000

各位帮看看,怎么解决!
...全文
556 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq143626 2016-07-08
  • 打赏
  • 举报
回复
二楼说的有道理
鐵蛋 2016-07-08
  • 打赏
  • 举报
回复
很明显是没有sslm这个字段,他用的是FindField,没找到这个字段,你又AsString,于是地址就异常了
天行归来 2016-07-08
  • 打赏
  • 举报
回复
if DBGrideh1.DataSource.DataSet=nil then exit; //可能未绑定数据集 //可能无sslm字段 if DBGrideh1.DataSource.DataSet.FindField('sslm')<>nil then begin if (DBGrideh1.DataSource.DataSet.FindField('sslm').AsString ='1' ); end;
lyhoo163 2016-07-07
  • 打赏
  • 举报
回复
if (DBGrideh1.DataSource.DataSet.FindField('sslm').AsString ='1' ) then 此句, 1、DBGrideh1未打开,或未连接数据集时,出现错误。 2、DBGrideh1对应的数据集中,无'sslm'字段,也会出错。
jjpweb 2016-07-07
  • 打赏
  • 举报
回复
不应该是这一句的错,看样子是 某个类没被创建。

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧