连接数据库时产生异常(50分)

  • 主题发起人 主题发起人 desertyj
  • 开始时间 开始时间
D

desertyj

Unregistered / Unconfirmed
GUEST, unregistred user!
提示下列错误:<br>Project &nbsp; set_form1.exe &nbsp; raised &nbsp; exception &nbsp; class &nbsp; EAccessViolation &nbsp; with &nbsp; <br>message &nbsp; 'Access &nbsp; violation &nbsp; at &nbsp; address &nbsp; 004ADAA7 &nbsp; in &nbsp; module <br>'set_form1.exe '. &nbsp; Read &nbsp; of &nbsp; address &nbsp; 00000058 '. &nbsp; Process &nbsp; stopped. &nbsp; Use <br>Step &nbsp; or &nbsp; Run &nbsp; to &nbsp; continue. <br><br>然后光标就停在: &nbsp; "QXM_ADOQ.Connection:=ksxt_DM.tk_ADOC" &nbsp; 这一行. <br><br>请各位大虾帮忙解决下,小弟在此谢过了!(小弟是个初学者)<br>代码如下<br>procedure TSet_F.FormShow(Sender: TObject);<br>var<br>&nbsp; QXM_ADOQ:TADOQuery;<br>begin<br>&nbsp; YH_ADOQ.Close;<br>&nbsp; YH_ADOQ.SQL.Clear;<br>&nbsp; YH_ADOQ.SQL.Add('SELECT A.UserName as 用户名,B.qxid as 权限 FROM yh AS A ');<br>&nbsp; YH_ADOQ.SQL.Add('INNER JOIN QX AS B ON A.QXID=B.QXID');<br>&nbsp; YH_ADOQ.Open;<br>&nbsp; QXM_ADOQ:=TADOQuery.Create(nil);<br>&nbsp; QXM_ADOQ.Connection:=ksxt_DM.tk_ADOC;<br>&nbsp; QXM_ADOQ.SQL.Add('SELECT qxm FROM qx');<br>&nbsp; QXM_ADOQ.Open;<br>&nbsp; while not QXM_ADOQ.Eof do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; QX_CB.Items.Add(QXM_ADOQ.FieldValues['QXM']);<br>&nbsp; &nbsp; &nbsp; QXM_ADOQ.Next;<br>&nbsp; &nbsp; end;<br>&nbsp; QXM_ADOQ.Close;<br>&nbsp; FreeAndNil(QXM_ADOQ);<br><br>&nbsp; ShowYHInfo;<br><br>&nbsp; YH_ADOT.TableName:='yh';<br>&nbsp; YH_ADOT.Open;<br>end;
 

Similar threads

后退
顶部