2

It seems that whenever I add anything to my project which uses code in my commonClass.vb file, I get errors about SQL Server not being recognized.

I do have a reference to DAL05.

SQL Server in the file shows it's not recognized, as does the DAL05.DataAccess imports:

enter image description here

Do I need to add another reference? Another or a different Imports? Or what?

As you can see, I am referencing DAL05, and it is not offered as a way for SQL Server to be recognized:

enter image description here

UPDATE:

A possibly significant factoid: A difference between the legacy project - which has no problem with recognizing SQL Server - is that it does not even have a References folder; DAL05.dll (and DAL05.pdb) are below \<project>\bin\Common

So should I force a Bin and Bin\Common folder into my project (via Windows Explorer) and then add those files there? Is that the solution (no pun intended)?

UPDATE 2:

Okay, now this is getting really weird; based on a clue I found here about a similar issue, I prepended DAL095.DataAccess. to the SQL Server like so:

Dim sqlDAL As New DAL05.DataAccess.SQLServer(

The results are as follows:

  1. This does NOT reduce the number of errors.

  2. This seems superfluous/moot because DAL05.DataAccess." is grayed out.

  3. The red underscore on the second and last r of SQLServer is NOT removed.

Yet, when I 2-click the top "Type 'SQLServer' is not defined." error msg from the error list, it no longer takes me to the references to "SQLServer" to which I have appended the seemingly useless "DAL05.DataAccess" but go instead only to the "naked" references to "New SQLServer":

enter image description here

In case it means anything, a failing function is:

Public Function GetUserInfo(ByVal userid As String, ByVal password As String, ByVal memberno As String) As DataTable
    Dim sqlDAL As New SQLServer(System.Configuration.ConfigurationManager.AppSettings("OrderEnterConnection"))
    Dim dset As DataSet
    dset = sqlDAL.runSQLDataSet("Exec up_GetUserData_Web_2012 '" + userid + "','" + password + "','" + memberno + "'")
    Return dset.Tables(0)
End Function

UPDATE 3:

Ever stranger: after I changed this:

Imports DAL05.DataAccess

...to this:

Imports DAL05.DataAccess.SQLServer

I was finally given some seemingly sensible Intellisense help; it said,

Import DAL05.DataAccess.SQLServer' and other missing references?

I accepted that, but I still have the same 204 errors.

And Imports DAL05.DataAccess.SQLServer is completely grayed out, with the following helpful msg:

enter image description here

Community
  • 1
  • 1
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • 1
    Not that *I* dont believe you but the image could *prove* it has that reference a) [Show all Files](http://stackoverflow.com/a/33721163/1070452) b) expand the **References** node to show any issues with references Maybe it is under that tooltip? – Ňɏssa Pøngjǣrdenlarp Dec 02 '16 at 23:10
  • Added another screen shot. – B. Clay Shannon-B. Crow Raven Dec 02 '16 at 23:29
  • As I recommended in your earlier question: http://stackoverflow.com/questions/40939639/is-it-not-possible-to-add-a-folder-to-an-asp-net-bin-folder?noredirect=1#comment69095869_40939639 when it comes to assemblies (DLLs) you will have to remove the references and re-add them/ – DaniDev Dec 02 '16 at 23:32
  • If you have imported the project file from somewhere else it is likely that your reference is pointing to a location that is no longer correct – DaniDev Dec 02 '16 at 23:34
  • There is no project file (such as .vbproj); there is only an .sln. And for that reason it doesn't seem that I can add the legacy project to the solution. – B. Clay Shannon-B. Crow Raven Dec 02 '16 at 23:36
  • 1
    See previous comment regarding Object Browser and viewing namespaces and types in DAL05 - it offers that import because you are tying to create a `New DAL05.DataAccess.SQLServer`. We have no idea if those make sense. – Ňɏssa Pøngjǣrdenlarp Dec 05 '16 at 21:43
  • 2
    The first image show that `commonclass` has an error on the class declaration line (`Public class commonclass`) can you show it? – Yahfoufi Dec 06 '16 at 15:34
  • @m.yahfoufi: I'm not seeing that. You can see a larger version of the image by clicking it, if that's what you mean. I dont' see the err on the line you specify, though. The only exception I'm getting now is "Object reference not set to an instance of an object" with no line or column or even file or project supplied to help me clue it out. – B. Clay Shannon-B. Crow Raven Dec 06 '16 at 16:11
  • @B.ClayShannon `Imports DAL05...` is underlined and also `Public Class commonClass` is underlined. what is the error shown when mouse hover `commonclass`?? this also appear in the last image – Yahfoufi Dec 06 '16 at 16:23
  • @m.yahfoufi: Oh, I see it now; that is no longer an issue - it is currently not squigglified. – B. Clay Shannon-B. Crow Raven Dec 06 '16 at 16:33
  • 2
    I've faced with this error when the .NET Framework version of the referenced dll is not compatible with the project. Are the .NET version of your current project and DAL05.dll different? – Reza Aghaei Dec 07 '16 at 11:05
  • Did you check the .NET Framework version of dll and the project? – Reza Aghaei Dec 07 '16 at 23:37
  • @RezaAghaei: Yes, it is, and must remain, 3.5. All these crazy errors and problems were fixed, though (I guess) by some combination of 1) removing TFS bindings and references in the .sln file 2) Deleting the .suo files and 3) Running VS as Administrator. I go into a little more detail here: http://stackoverflow.com/questions/40985897/what-is-wrong-with-this-type-of-aspx-code/41027959#41027959 – B. Clay Shannon-B. Crow Raven Dec 07 '16 at 23:41
  • 1
    Have you tried opening the project as a Web Site and not as a Solution? Also have you converted the website into an Application? – Fandango68 Dec 09 '16 at 01:14
  • @Fernando: I solved this by 1) getting rid of all the TFS vestiges (files and entries in the .sln file); 2) Deleting the .suo files and (probably had nothing to do with it) 3) Opening Visual Studio as administrator. BTW, are you the cat that Abba sang about? – B. Clay Shannon-B. Crow Raven Dec 09 '16 at 15:46
  • If anybody wants to answer this using what I came up with, I'll award them the bounty. – B. Clay Shannon-B. Crow Raven Dec 09 '16 at 17:18

1 Answers1

1

As @B. Clay Shannon (the OP) Commented the solution is:

1) getting rid of all the TFS vestiges (files and entries in the .sln file);

2) Deleting the .suo files and (probably had nothing to do with it)

3) Opening Visual Studio as administrator.

Another Case

I was having the same problem and i does the following steps

1) closing all the open tabs, cleaning all the projects and rebuilding,

2) shutting down all my Visual Studio instances

3) restarting my computer.

and it fixed the issue

Community
  • 1
  • 1
Hadi
  • 36,233
  • 13
  • 65
  • 124