Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

VB.Net "Interface" error, not sure what's missing

This code works fine in C#:
http://aspalliance.com/837_Implementing_a_Data_Access_Layer_in_C

I copied and pasted it here to convet it to VB.Net:
http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx

I took the entire VB.Net code, and copied it to a class (this is asp.net 2.0, WAP)...

 I get this error ( Blue line under "Implements IDBManager" )saying to implement each function in IDBManager. I have no clue what I'm missing...
This is a simplified code:


Namespace DataAccessLayer

    Public Interface IDBManager
      ...
    Sub Open()
End Interface
End Namespace

Namespace DataAccessLayer

    Public NotInheritable Class DBManager
        Implements IDBManager  '[b] blue error line under IDBManager [/b]

      Public Sub Open()
            idbConnection = DBManagerFactory.GetConnection(Me.providerType)
            idbConnection.ConnectionString = Me.ConnectionString
            If Not (idbConnection.State = ConnectionState.Open) Then
                idbConnection.Open()
            End If
            Me.idbCommand = DBManagerFactory.GetCommand(Me.providerType)
        End Sub

End Class
End Namespace
   



[b] error is : Class 'DBManager' must implement 'Sub Open()' for interface 'IDBManager' [/b]
any ideas?
Avatar of Kinger247
Kinger247

The interface requires all its elements (procs/funcs/props etc) in IDBManager to be in your source.
I think one (or more) of these is missing. There are alot there so you'll need to check.
But basically all procs/funcs/props etc need to be in the DBManager class you implemented the Interface IDBManager.
Avatar of Camillia

ASKER

I commented out everything in IDBManager except for "Sub Open()".

Then in DBManager, I do see :
 Public Sub Open()
            idbConnection = DBManagerFactory.GetConnection(Me.providerType)
            idbConnection.ConnectionString = Me.ConnectionString
            If Not (idbConnection.State = ConnectionState.Open) Then
                idbConnection.Open()
            End If
            Me.idbCommand = DBManagerFactory.GetCommand(Me.providerType)
        End Sub

But I get an error that "Sub Open" must be implmeneted. I am implementing it!!!
ASKER CERTIFIED SOLUTION
Avatar of Kinger247
Kinger247

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ah, yes. Thanks.