我想用Adodc与DataGrid绑定,在DataGrid中调用Excel文件,问如何实现Adodc与Excel的数据源连接,
在“属性->记录源”对话框中如何设置“命令类型”和“命令文本”?
 不吝赐教,万分感谢!

解决方案 »

  1.   

    Adodc与Excel的数据源连接sql = "select * from [SheetLabelName$]"
      With Adodc
        .ConnectionString = "provider=microsoft.jet.oledb.4.0;persist security info=false;" & _
                            "data source=" & PathName & ";extended properties='" & _
                            "excel 8.0;hdr=yes'"
        .CommandType = adCmdText
        .RecordSource = sql
        .Refresh
      End With
    只是ConnectionString与连接数据库有所不同,其它操作一样的