Why is SQL Server not recognized, even though I've got a reference to DAL05.dll?

余生长醉 提交于 2019-12-04 04:56:07

问题


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:

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:

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":

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:


回答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



来源:https://stackoverflow.com/questions/40942190/why-is-sql-server-not-recognized-even-though-ive-got-a-reference-to-dal05-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!