C # read database prompt object "xxxx" is invalid

@ 好好 zhang 先生 The
host computer can open the database but cannot read the data . The host computer can
connect to the database normally because the code conn.Open();can be executed normally.
However, when C # executes the query function, an error is reported and the object name "UserInfos" is invalid.
Insert picture description here
In SQL, use the query statement , Can also correctly find the corresponding data.
Select GradeId, GradeName from GradeInfo
Insert picture description here
This problem is driving people crazy, the final solution is as follows:
First, log in as sa administrator, right-click user property changes: the
original database is master
change The default database is the database you use.
Insert picture description here
Insert picture description here
Similarly, log in to your own account and make the same changes.
Insert picture description here
Finally, reconnect to the database and you are done.
Insert picture description here
At this point, the host computer can correctly read the contents of the database.

Hope to help you friends! !

Published 18 original articles · Likes0 · Visits 234

Guess you like

Origin blog.csdn.net/qq_39217004/article/details/105230385