Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want to retrieve data from an excel sheet and display it in datagrid. I have the following code(not showing the declarations) :

 

con = New OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=c:\CAD.xls;Extended Properties=""Excel 8.0""")

cmd = New OleDb.OleDbCommand("Select * from [delete2$]", con)

dataset.Clear()

Try

adap.SelectCommand = cmd

adap.Fill(dataset, "[delete2$]")

dg.DataSource = dataset.Tables(0).DefaultView

Catch exp As Exception

MsgBox(exp.Message)

End Try

 

the program is neither giving any error nor displaying the contents of the excel sheet.Please guide me how to display the contents of the excel sheet(File name is CAD.xls and the sheet name is delete2).

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...