如果你只是偶尔用下,建议用:
select * from database1.dbo.table
长期使用的话,在程序的连接代码指定好:如二楼:
SqlConnection mysql = new SqlConnection("data source=localhost;integrated security=true;initial catalog= database1");
是连接Connection的设置问题,与SQL语句无关
SqlConnection mysql = new SqlConnection("data source=localhost;integrated security=true;initial catalog= database1");
use database1