1

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?

4

1 回答 1

0

这是一个迟来的回应,但其他开发人员可能会发现它很有用。

 myDataBase.Refresh();
 var tableName = "sometable";
 **myDataBase.Tables.Refresh();**
 Table t = myDataBase.Tables[tableName];
于 2014-02-13T08:55:39.617 回答