我想收集有关特定表的信息,所以这是我的代码:
StringBuilder sb = new StringBuilder();
sb.AppendLine();
ServerConnection conn = new ServerConnection();
conn.ConnectionString = "";//MyConnection string
Server srv = new Server(conn);
Database db = srv.Databases["MyDataBase"];
Table tb = db.Tables["MyTable"];
foreach(Column c in tb.Columns) {
sb.AppendLine(c.Name + " -> " + c.DataType.ToString());
sb.AppendLine(c.ExtendedProperties["MS_Description"].Value.ToString());
if(c.IsForeignKey){
//Need to get reference here:
//Sb.AppendLine("ReferenceColumn")
//Sb.AppendLine("ReferenceTable")
//Sb.AppendLine("ReferenceSchema")
}
}
我找到了这个,但是这个链接Foreignkeys
首先得到了,有没有办法在这里找到参考(按Column
类型)?在这种情况下你有什么建议?