非常着急
EXCEL表里有一个EXCEL 字段:
车牌
A001K6
A001K7
A001L0
A001L6 
A002J2
A002K1 
A002K2 
打开代码如下:      //ADOsource1为adoconnection, qrysource1为adoquery;
     AdoSource1.Connected:=false;//多次打开出错问题
      EdtSource.Text:=OPD.FileName;
      AdoSource1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0 '
                                      +';Data Source='+EdtSource.Text
                                      +';Extended Properties=Excel 8.0 '
                                      +';Persist Security Info=False ';      AdoSource1.LoginPrompt:=False;
      //Ls:=TStringList.Create;
     // AdoSource1.GetTableNames(Ls,false);        try
        AdoExcute.Execute('drop table source1')
        except
          ;;
        end;
      with QrySource1 do
      begin
        Close;
        SQL.Clear;
        SQL.text:='Select   distinct *  from [sheet1$] in '
                  +'"'+EdtSource.Text +'" "Excel 8.0;hdr=yes;imex=1"';
        open;
      end;

解决方案 »

  1.   

    在AdoSource1.ConnectionString中的ConnectionString中加入字符串:AutoTranslate=False;
      

  2.   

    这个代码可以打开,并显示在DBGRID的,请大家帮忙看一下,我现在在重新安装DELPHI.之前删除了2007现在有好多不好用的地方.
      

  3.   

    一部分车牌后面多了问号,没有别的乱码.就是后面多问号.真急人.
    A001K6? 
    A001K7 
    A001L0 
    A001L6?  
    A002J2 
    A002K1  
    A002K2 
      

  4.   

    兄弟,加上AutoTranslate=False这个在打开EXCEL时提示"找不到可安装的ISAM"
    哪位碰到过类似问题啊.解决一下吧..
      

  5.   

    是不是excel里的内容有问题,带什么格式吗
      

  6.   

          AdoSource1.Connected:=false;
          EdtSource.Text:=OPD.FileName;
          AdoSource1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0 '
                                          +';Data Source='+EdtSource.Text
                                          +';Extended Properties=Excel 8.0 '
                                          +';Persist Security Info=False ';
          AdoSource1.LoginPrompt:=False;
          with QrySource1 do
          begin
            Close;
            SQL.Clear;
            SQL.text:='Select   distinct *  from [sheet1$] in '
                      +'"'+EdtSource.Text +'" "Excel 8.0;hdr=yes;imex=1"';
            open;
          end;
    就是用以上代码打开的,现在简化了,但是仍然会用乱码..
      

  7.   

    发几篇delphi操作office的文章
    http://hi.baidu.com/lingyin55/blog/category/delphi%B6%D4office%B5%C4%B2%D9%D7%F7是不是你的excel里面有其它的内容?或者是类型的问题?
      

  8.   

    procedure TForm1.BitBtn2Click(Sender: TObject); 
    begin 
      opendialog1.Execute; 
      adoconnection1.Close; 
      adoconnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;' 
      +'Data Source='+opendialog1.FileName+';' 
      +'Extended Properties=excel 8.0;' 
      +'Persist Security Info=False'; 
      with adoquery1 do 
        begin 
          Close; 
          SQL.Clear; 
          sQL.Text:='Select * from [sheet1$]'; 
          open; 
        end; 
    end; end. 
      

  9.   

    需要的控件:adoquery,adoconnection,datasource,dbgrib,bitbtn
    在bitbtn里面添加这段代码就行了,adoconnection里面不需要设置,adoquery,datasource,dbgrib自己关联下就ok了
      

  10.   

    乱码的事Excel表资料的问题, 你可建立一个新的xls文件, 手工输入几笔资料,然后用程式读出来试试!
      

  11.   

    今天正好遇到同样的问题,将文件名和WorkBook名改成字母或数字就ok了。你可以试试。