I'm developing my app in VB.Net with the source below but the problem that I got, was the data not displayed completely in DataGridView
.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As OleDb.OleDbConnection
Dim dta As OleDb.OleDbDataAdapter
Dim dts As DataSet
Dim excelpath As String
Dim ExcelQuery As String = "Select * From [IOT_NOVA$B12:S257]"
Try
If TextBox1.Text = "" Then
MsgBox("Please select Excel file to upload!", vbExclamation)
Exit Sub
End If
excelpath = TextBox1.Text
conn = New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelpath + ";Extended Properties='Excel 12.0;HDR=YES;IMEX=1';")
dta = New OleDb.OleDbDataAdapter(ExcelQuery, conn)
DtSet = New DataTable
dta.Fill(DtSet)
DataGridView1.DataSource = DtSet
conn.Close()
conn.Dispose()
Catch ex As Exception
MsgBox(ex.Message, vbCritical)
End Try
End Sub