以下是读取excel的代码﹐遇到的问题我写在代码下面
procedure  TForm1.Button1Click(Sender:  TObject);  
 
var  
   SqlStr:  string;  
   SqlStr1:  string;  
begin      ///  
   SqlStr1:='Data  Source='+Trim(Ed_File.Text)+';User    ID=Admin;Password=;Extended  properties=Excel  8.0';  
   SqlStr:='  SELECT  *    FROM  ';  
   SqlStr:=SqlStr+'  OpenDataSource(  '+''''+'Microsoft.Jet.OLEDB.4.0'+''''+',';  
   SqlStr:=SqlStr+''''+SqlStr1+'''';  
   SqlStr:=SqlStr+')...sheet1$';  
 
   //Exit;  
   with  Qry  do  
             begin  
                 Sql.Clear;  
                 Sql.Add(SqlStr);  
                   memo1.Text:=  qry.SQL.Text;  
                 open;  
 
                 showmessage('成功!  :)  ')  
             end;  
end;  
 
 
procedure  TForm1.FormCreate(Sender:  TObject);  
begin  
 Qry.ConnectionString:=  'Provider=Microsoft.Jet.OLEDB.4.0;Data  Source=D:\sheet1.xls;Persist  Security  Info=False;Extended  Properties=excel  5.0  ;  ';  
 
///Qry.ConnectionString:=  'Provider=SQLOLEDB.1;Persist  Security  Info=False;User  ID=sa;Initial  Catalog=;Data  Source=';  end;  
 上面这段源代码﹐当  
 Qry.ConnectionString:=  'Provider=Microsoft.Jet.OLEDB.4.0;Data  Source=D:\sheet1.xls;Persist  Security  Info=False;Extended  Properties=excel  5.0  ;  ';  
就提示  from  子句中语法错误﹐  
当  
Qry.ConnectionString:=  'Provider=SQLOLEDB.1;Persist  Security  Info=False;User  ID=sa;Initial  Catalog=;Data  Source=';  
时就可以通过﹐但是两种Qry.ConnectionString所生成的sql语句都是一样的。  如下﹕SELECT *  FROM  OpenDataSource( 'Microsoft.Jet.OLEDB.4.0','Data Source=D:\Sheet1.xls;User ID=Admin;Password=;Extended properties=Excel 8.0')...sheet1$(通不過的)
SELECT *  FROM  OpenDataSource( 'Microsoft.Jet.OLEDB.4.0','Data Source=D:\Sheet1.xls;User ID=Admin;Password=;Extended properties=Excel 8.0')...sheet1$ (通過的) 
我把生成的两个sql语句复制到查询分析器中运行﹐两个都可以查到。  
 
我用memo1.text:=qry.sql.text获取了一样的sql语句﹐是不是adoquery的sql里还有隐藏起来的语句呀  ﹖  
 
请高手帮忙﹗