Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-11-01
4
Medium Priority
?
405 Views
Last Modified: 2008-02-01
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?
0
Comment
Question by:Camillia
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:Kinger247
ID: 17853074
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.
0
 
LVL 7

Author Comment

by:Camillia
ID: 17853128
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!!!
0
 
LVL 10

Accepted Solution

by:
Kinger247 earned 2000 total points
ID: 17853182
That line should be :

Public Sub Open() Implements IDBManager.Open

0
 
LVL 7

Author Comment

by:Camillia
ID: 17853196
Ah, yes. Thanks.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question