Click here to Skip to main content
15,914,013 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Best data structure in VB .NET 4.0 ?! Pin
Luc Pattyn22-May-10 8:42
sitebuilderLuc Pattyn22-May-10 8:42 
QuestionCopy Excel Data into Access Database Table. Pin
jeshra27922-May-10 3:52
jeshra27922-May-10 3:52 
AnswerRe: Copy Excel Data into Access Database Table. Pin
DaveAuld22-May-10 4:02
professionalDaveAuld22-May-10 4:02 
GeneralRe: Copy Excel Data into Access Database Table. Pin
Dalek Dave22-May-10 4:17
professionalDalek Dave22-May-10 4:17 
GeneralRe: Copy Excel Data into Access Database Table. Pin
jeshra27922-May-10 4:51
jeshra27922-May-10 4:51 
GeneralRe: Copy Excel Data into Access Database Table. Pin
DaveAuld22-May-10 5:02
professionalDaveAuld22-May-10 5:02 
GeneralRe: Copy Excel Data into Access Database Table. Pin
jeshra27922-May-10 5:40
jeshra27922-May-10 5:40 
GeneralRe: Copy Excel Data into Access Database Table. Pin
DaveAuld22-May-10 20:48
professionalDaveAuld22-May-10 20:48 
I created a Student.XLSX file with the 3 columns as you stated in your OP.

The code below successfully ran and imported the data to a dataset which was then bound to a DataGridView;

VB.NET
'Build the connectionstring
Dim conBuilder As New OleDbConnectionStringBuilder
conBuilder.Provider = "Microsoft.Jet.OLEDB.4.0"
conBuilder.DataSource = "C:\Users\Dave Auld\Desktop\Student.xlsx"
conBuilder.PersistSecurityInfo = False
conBuilder.Add("Extended Properties", "Excel 8.0;HDR=YES;")

'Create the connection
Dim con As New OleDbConnection
con.ConnectionString = conBuilder.ConnectionString

'create the data command
Dim com As New OleDbCommand("Select * from [Sheet1$]")
com.Connection = con

'create the data adapter
Dim da As New OleDbDataAdapter(com)

'Create the data set
Dim ds As New DataSet

Dim rowcount As Integer = da.Fill(ds)

'Attach to the data grid view
DataGridView1.DataSource = ds
DataGridView1.DataMember = ds.Tables(0).TableName

Dave

Don't forget to rate messages!
Find Me On: Web|Facebook|Twitter|LinkedIn
Waving? dave.m.auld[at]googlewave.com


GeneralRe: Copy Excel Data into Access Database Table. Pin
jeshra27923-May-10 18:53
jeshra27923-May-10 18:53 
QuestionCompare two scanned images! Pin
FeRtoll21-May-10 8:26
FeRtoll21-May-10 8:26 
AnswerRe: Compare two scanned images! Pin
Dave Kreskowiak21-May-10 9:15
mveDave Kreskowiak21-May-10 9:15 
GeneralRe: Compare two scanned images! Pin
FeRtoll21-May-10 11:42
FeRtoll21-May-10 11:42 
GeneralRe: Compare two scanned images! Pin
FeRtoll21-May-10 13:34
FeRtoll21-May-10 13:34 
GeneralRe: Compare two scanned images! Pin
Dave Kreskowiak22-May-10 14:45
mveDave Kreskowiak22-May-10 14:45 
GeneralRe: Compare two scanned images! Pin
FeRtoll23-May-10 0:07
FeRtoll23-May-10 0:07 
GeneralRe: Compare two scanned images! Pin
FeRtoll23-May-10 10:33
FeRtoll23-May-10 10:33 
GeneralRe: Compare two scanned images! Pin
Dave Kreskowiak23-May-10 18:08
mveDave Kreskowiak23-May-10 18:08 
GeneralRe: Compare two scanned images! Pin
FeRtoll23-May-10 22:12
FeRtoll23-May-10 22:12 
Questioninfragistics ultrawingrid tabbing problem Pin
soterios21-May-10 3:22
soterios21-May-10 3:22 
AnswerRe: infragistics ultrawingrid tabbing problem Pin
Dave Kreskowiak21-May-10 6:57
mveDave Kreskowiak21-May-10 6:57 
QuestionCD (data or music) or DVD Pin
JR21221-May-10 0:10
JR21221-May-10 0:10 
AnswerRe: CD (data or music) or DVD Pin
JHizzle21-May-10 0:46
JHizzle21-May-10 0:46 
AnswerRe: CD (data or music) or DVD Pin
DaveAuld21-May-10 0:51
professionalDaveAuld21-May-10 0:51 
AnswerRe: CD (data or music) or DVD Pin
Baconbutty21-May-10 2:58
Baconbutty21-May-10 2:58 
GeneralRe: CD (data or music) or DVD Pin
Luc Pattyn21-May-10 3:08
sitebuilderLuc Pattyn21-May-10 3:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.