excel表必須是97-2003格式的。否則無法查詢。
imports system.data.oledb
public class form1
private sub button1_click(byval sender as system.object, byval e as _
system.eventargs) handles button1.click
dim connectiongstring as string
dim path as string
dim dialgo as openfiledialog = new openfiledialog
dim connection as oledbconnection = new oledbconnection
dim adapter as oledbdataadapter
dialgo.filter = "excel document (*.xls)|*.xls"
dialgo.showdialog()
path = dialgo.filename
connectiongstring = "provider=microsoft.jet.oledb.4.0;data source=" _
+ path + ";extended properties='excel 8.0;hdr=no;imex=0'"
connection.connectionstring = connectiongstring
connection.open()
adapter = new oledbdataadapter("select * from [sheet1$] where b = 4",
connection)
adapter.fill(dataset1)
msgbox(dataset1.tables(0).rows(0).item(0))
connection.close()
end sub
end class
相關政策: Delphi ADO 連線Excel資料來源
將乙個excel 當作是乙個資料庫,利用ado元件實現獲取excel中的資料顯示到介面中,如下 unit unit1 inte ce uses windows,messages,sysutils,variants,classes,graphics,controls,forms,dialogs,db,...
delphi連線資料來源
adoconn.connectionstring provider sqloledb.1 persist security info true use procedure for prepare 1 auto translate true packet size 4096 use encryptio...
iReport 連線資料來源
ireport 也是開源組織sf.net 中的一款免費軟體,其主要作用是用來以視覺化的方式設計 生成jasperreport 所使用的報 式檔案,因為jasperreport 本身並未提供很好的視覺化報 表設計工具,ireport 的出現正好彌補了這個缺陷。報表連線資料來源,必須先設定好classp...