문제

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];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top