我有一个连接到Sql Server并获取一些值的控制台应用程序。我在选择(DBO)架构:在连接字符串中指定Sql Server架构C#
var ds = new DataTable("test");
var connSqlRemoto = new SqlConnection("Server=myserverIP;Database=myDataBase;User Id=user;Password=pass;Integrated Security=False;Connection Timeout=60");
connSqlRemoto.Open();
var nombreBbdd = connSqlRemoto.Database;
var daASqlRemoto = new SqlDataAdapter();
var cmdSqlRemoto = new SqlCommand("SELECT * FROM " + nombreBbdd + ".dbo.myTable;", connSqlRemoto);
cmdSqlRemoto.CommandTimeout = 1200;
cmdSqlRemoto.Parameters.Clear();
daASqlRemoto.SelectCommand = cmdSqlRemoto;
daASqlRemoto.Fill(ds);
我想德模式是动态的。所以: 是否有可能在连接字符串中传递模式? 这样的事情是不工作:
Server=myserverIP;Database=myDataBase/dbo;User Id=user;Password=pass;Integrated Security=False;Connection Timeout=60
或
Server=myserverIP;Database=myDataBase.otherSchema;User Id=user;Password=pass;Integrated Security=False;Connection Timeout=60
感谢。
[不,这是在数据库用户级别完成的,而不是在连接字符串中](http://stackoverflow.com/a/3282716/1042848) –
'我想要架构是动态的。所以:是否有可能在连接字符串中传递模式?'如果模式是动态的,当你传递连接字符串 – TheGameiswar
好的时候,谢谢。 @TheGameiswar因为它是一个接收不同连接字符串的应用程序。 – Za7pi