This is a belated response but other developers may find it useful.
myDataBase.Refresh();
var tableName = "sometable";
**myDataBase.Tables.Refresh();**
Table t = myDataBase.Tables[tableName];
質問
I'm writting a simple t4 template to create scripts for my SQL Server 2008 database. This lines of code:
1 myDataBase.Refresh();
2 var tableName = "sometable";
3 Table t = myDataBase.Tables[tableName];
are resulting in t == null
. The "sometable" is in my database and is not mispelled, the connection works fine. Debbuging the template and returning the execution point to the line 3 populates the t
variable correctly. Someone can help me to undestand what's happening?
解決
This is a belated response but other developers may find it useful.
myDataBase.Refresh();
var tableName = "sometable";
**myDataBase.Tables.Refresh();**
Table t = myDataBase.Tables[tableName];