Hello i have a problem on connecting my database.
i have this kind of code which would get the item in the combobox and use it as my connection
Dim ConFunnelLocation As String = "C:\Database\Funnel\" & Form_Funnel_Report.Combo_Funnel_EBU.Text & ".xls"
and a table
Dim TblFunnelCon As String = Form_Funnel_Report.Combo_Funnel_AM.Text & "$"
so this could be my code.
con.ConnectionString = ("provider=Microsoft.Jet.OLEDB.4.0; Data Source='" & ConFunnelLocation & "';Extended Properties=Excel 8.0;")
con.Open()
dt.Clear()
ds.Tables.Add(dt)
Try
With Form_Funnel_Report
Dim da As New OleDbDataAdapter("Select * from [" & TblFunnelCon & "]", con)
da.Fill(dt)
But it cannot open my database.
unless i change my declaration to the specific name of my Table and my Excel file like this
Dim ConFunnelLocation As String = "C:\Database\Funnel\EBU 1.xls"
Dim TblFunnelCon As String = "Sheryl Manuel$"
this work fine but i need to use combobox so it will lessen my code and it can be more flexible.
please help me. thank you in advanced.