+92 332 4229 857 99ProjectIdeas@Gmail.com

How to create excel connection (Vb.net)

Connection creation in excel

CreateConnString function takes filePath as a string its parameter and creates a connection with the excel file (.xls) and returns a connection string.
filePath is the location of the file in your computer.

Public Function CreateConnString(ByVal filePath As String) As String
        Return "provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
            " '" & filePath & "';Extended Properties=Excel 8.0;"
End Function