what's up when i call the function below i get an error that says that oledb is not regstered on this machine

i am calling the function like this

ListBox1.Items.Add(getAllTableNames)
Public Shared Function getAllTableNames() As String()
        Dim con As OleDb.OleDbConnection
        Dim com As New OleDbCommand

        Dim i As Integer
        Dim str() As String
        'Give your database path
        'ConnectionString = "provider=OleDb;server=;uid=;pwd=;database="
        con = New OleDb.OleDbConnection("provider=OleDb;server;uid=;pwd=;database=")
        con.Open()
        com.Connection = con
        Dim dtable As DataTable
        Try

            dtable = con.GetOleDbSchemaTable(OleDb.OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
            'Table_Catalog,table_Schema,table_name,table_type

            For i = 0 To dtable.Rows.Count - 1
                ReDim Preserve str(i)
                str(i) = dtable.Rows(i).Item(2).ToString
            Next
            Return str
        Catch ex As Exception
            Return Nothing
        End Try
    End Function

You have a wrong connection string. Which database are you using?

I have removed the server name and other sensitive infor but it looks a little like this:

con = New OleDb.OleDbConnection("provider=OleDb;server=sql...;uid=....;pwd=....;database=.....")

Which database product (e.g. MS-SQL, MySQL, Oracle, Ms-Access) you have been using?

ms sql 2005

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.