タイトル | : 追記 |
記事No | : 10641 |
投稿日 | : 2011/12/15(Thu) 18:33 |
投稿者 | : でらでら |
DataGridViewには以下で表示させています(拾いものを使っています).
Using cn As New System.Data.OleDb.OleDbConnection Dim FileName As String = System.IO.Path.Combine(Application.StartupPath(), "appdata\kr.xls") Dim SheetName As String = "Sheet1" cn.ConnectionString = "provider=Microsoft.jet.OLEDB.4.0;Data source=" & FileName & ";Extended properties=""Excel 8.0;HDR=YES;IMEX=1""" Using da As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter("SELECT * FROM [" & SheetName & "$]", cn) Dim ds As New DataSet da.Fill(ds, SheetName & "$") DataGridView1.DataSource = ds.Tables(SheetName & "$") End Using End Using
|