On web from, how to get absolute path after user select an local excel file ?
Kerry Ou
226
Reputation points
Hi all,
I want to import excel file to SQL on web from, how can I get the absolute path after user select this file?
I want to get the Excel local absolute path put into textbox1 then change the data source
Dim fileName = textbox1.Text
like:
Dim strConn As String = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Admin\Desktop\Basic Data.xlsx;Extended Properties='Excel 12.0;HDR=YES'"
change:
Dim strConn As String = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source=" & fileName & " ;Extended Properties='Excel 12.0;HDR=YES'"
Protected Sub Bt_Ex_Click(ByVal sender As Object, ByVal e As EventArgs)
Try
Dim fileName = textbox1.Text
Dim strConn As String = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Admin\Desktop\Basic Data.xlsx;Extended Properties='Excel 12.0;HDR=YES'"
Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn)
Dim ds As DataSet = New DataSet
da.Fill(ds, "dw")
Thank you for your help.