'connection' is ambiguous in the namespace 'ADODB'

i encounter the following errors:

'connection' is ambiguous in the namespace 'ADODB'

and

'Recordset' is ambiguous in the namespace 'ADODB'

5 answers

You probably somehow have more than one reference to ADODB.

This is VB.Net right?

Check Project/Properties/References and make sure ADODB is referenced only once.

Yes it is vb.net
And yes i checked the references. Adodb is used only once..
Now what shall i do?
Can anyone help me please

Please update your question with the code used.

Also. Try to clean your output folder. (/bin directory)
Or use the clean command on the solution in VS.

It might be caused by old invalid dll's in app folder.

Imports System.Text.RegularExpressions

Module globalmodule
    Public conn As New ADODB.Connection
    Public rs As New ADODB.Recordset
    Public rss As New ADODB.Recordset
    Public trs As New ADODB.Recordset
    Public sql As String

    Public Function opendb()
        If conn.State = 1 Then conn.Close()
        conn.Open("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=dbEmployee;Data Source=TECHNOPU\SQL;")
        Return 0
    End Function
    Function EmailAddressCheck(ByVal emailAddress As String) As Boolean

        Dim pattern As String = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
        Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern)
        If emailAddressMatch.Success Then
            EmailAddressCheck = True
        Else
            EmailAddressCheck = False
        End If
        If EmailAddressCheck = False Then
            MsgBox("Entervalid E-mail ID")
        End If
    End Function

    Public empid As String

End Module

It might have to do with several projects in solution using different framework versions...

  • Do you have several projects in your solution?
  • Are they using the same .net framework version?
  • Are they referencing ADODB?