Compilation error in Visual Web Devloper, SiteCode is not declared

blossompark
blossompark used Ask the Experts™
on
Hi,
I am opening a website in Microsoft Visual web developer 2010 express, which worked before but now I'm getting an error

Compilation Error
  Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

 Compiler Error Message: BC30451: 'SiteCode' is not declared. It may be inaccessible due to its protection level.

Source Error:

it highlights the following code
Line 8:          aDb = SiteCode.openDBConnection(aDb)

Open in new window

which is in a file named openDB.vb

I tested the connection and it seems to be working fine....any guidance appreciated. Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Fernando SotoRetired
Distinguished Expert 2017
Commented:
In order to help with this we need to see the class this line of code is defined in, please post.
Software Engineer
Top Expert 2011
Commented:
Yes basically saying that Sitecode is not declared, show us the code where this is declared in openDB.vb if it is, and also the start of the Sitecode class if you have it.

Author

Commented:
Hi Fernando, this what you require?
Public Class openDB
    Public Shared Sub AddTarget(ByVal TargetName As String, ByVal nt_name As String)
        Dim aDb As New ADODB.Connection
        aDb = SiteCode.openDBConnection(aDb)
        aDb.Execute("EXECUTE [TEST_DB].[dbo].[AddTarget] '" & TargetName & "','" & nt_name & "'")
        aDb.Close()
    End Sub

Open in new window

Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Author

Commented:
ok...you need where it says SiteCode=
Fernando SotoRetired
Distinguished Expert 2017

Commented:
Show or upload the file that code is in. We need to see where you declare SiteCode where you use it in the code.

Author

Commented:
searched complete solution for  " sitecode= " and a few variations of this.
Not there.
Therein lies the issue I guess
Fernando SotoRetired
Distinguished Expert 2017
Commented:
Well if that is the case then you are missing an instantiation of the variable. You will need to figure out where to do that.
Fernando SotoRetired
Distinguished Expert 2017
Commented:
See where this is defined in your solution, openDBConnection.
Paul JacksonSoftware Engineer
Top Expert 2011
Commented:
It sounds like you are missing the class Sitecode from the project, try searching for just sitecode across the whole project or try looking at where you store your source code to see if there is a file you are missing. It may be that it is a completely separate project that is compiled and then referenced by your other project too.

Author

Commented:
Paul and Fernando,
Firstly apologies for not responding sooner.
Secondly, thank you for your inputs, it has been most helpful.
Finally I am closing this question for the time being, I need to be  in a position to devote more time to it  to supply ye with the information ye need and unfortunately not in a position to do that currently,
Thanks again and have a great weekend

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial