Camillia
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.GetConnec tion(Me.pr oviderType )
idbConnection.ConnectionSt ring = Me.ConnectionString
If Not (idbConnection.State = ConnectionState.Open) Then
idbConnection.Open()
End If
Me.idbCommand = DBManagerFactory.GetComman d(Me.provi derType)
End Sub
End Class
End Namespace
[b] error is : Class 'DBManager' must implement 'Sub Open()' for interface 'IDBManager' [/b]
any ideas?
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.GetConnec
idbConnection.ConnectionSt
If Not (idbConnection.State = ConnectionState.Open) Then
idbConnection.Open()
End If
Me.idbCommand = DBManagerFactory.GetComman
End Sub
End Class
End Namespace
[b] error is : Class 'DBManager' must implement 'Sub Open()' for interface 'IDBManager' [/b]
any ideas?
ASKER
I commented out everything in IDBManager except for "Sub Open()".
Then in DBManager, I do see :
Public Sub Open()
idbConnection = DBManagerFactory.GetConnec tion(Me.pr oviderType )
idbConnection.ConnectionSt ring = Me.ConnectionString
If Not (idbConnection.State = ConnectionState.Open) Then
idbConnection.Open()
End If
Me.idbCommand = DBManagerFactory.GetComman d(Me.provi derType)
End Sub
But I get an error that "Sub Open" must be implmeneted. I am implementing it!!!
Then in DBManager, I do see :
Public Sub Open()
idbConnection = DBManagerFactory.GetConnec
idbConnection.ConnectionSt
If Not (idbConnection.State = ConnectionState.Open) Then
idbConnection.Open()
End If
Me.idbCommand = DBManagerFactory.GetComman
End Sub
But I get an error that "Sub Open" must be implmeneted. I am implementing it!!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ah, yes. Thanks.
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.