请问各位高手,我创建一个窗体,在其上放一个BUTTON控件和EDIT控件,EDIT用于输入数据名,用的是DELPHI与SQL-SERVER数据库,再创建一个窗体FORM2,在其上放QREPORT控件用于制作报表的,当我单击FORM1的BUTTON控件时,就能显示出EDIT中数据库中的数据内容,代码如下:
form2.adoquery1.connectionstring:='';
form2.adoquery1.connectionstring:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=american';
form2.adotable1.connectionstring:='';
form2.adotable1.connectionstring:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=american' ;
form2.adotable1.tablename:='t_bus';
form2.adotable1.open;
form2.qrdbtext1.datafield:='c_ch';
application.createform(tform2,form2);
form2.quickrep1.preview;
不知错在哪里,不能显示出数据,如何改正,如何写代码,请指教

解决方案 »

  1.   

    application.createform(tform2,form2);form2.adoquery1.connectionstring:='';
    form2.adoquery1.connectionstring:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=american';
    form2.adotable1.connectionstring:='';
    form2.adotable1.connectionstring:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=american' ;
    form2.adotable1.tablename:='t_bus';
    form2.adotable1.open;
    form2.qrdbtext1.datafield:='c_ch';
    form2.quickrep1.preview;