Code Snippet
db.Tables[7] //this works fine; I can access table props/methods
db.Tables["EmployeePayHistory"] //returns a null
a null value is returned. (not just tables ,but just about any SMO collection).This same syntax works great with many other databases.
This returns true, however:
Code Snippet
db.Tables[7].Name == "EmployeePayHistory" // returns true
So is there some kind of character encoding or something that I need to use when referencing one of these collection items by name?
Try with a schema also :
like this db.Tables["<schema>.EmployeePayHistory"]
that is : db.Tables["dbo.EmployeePayHistory"]
Check the schema name of EmployeePayHistory.
Thanks
Naras.
|||Yes indeed, the schema was the issue.
I could not access the item in the collection using schema.tablename, but rather using this syntax:
Code Snippet
db.Tables["EmployeePayHistory","HumanResources"]
Thank you for your help!
No comments:
Post a Comment