我有腳本:如何從sql使用c#封裝這些數據?
select
fk.name,
object_name(fk.parent_object_id) 'Parent table',
c1.name 'Parent column',
object_name(fk.referenced_object_id) 'Referenced table',
c2.name 'Referenced column'
from
sys.foreign_keys fk
inner join
sys.foreign_key_columns fkc ON fk.object_id = fkc.constraint_object_id
inner join
sys.columns c1 ON fkc.parent_column_id = c1.column_id and c1.object_id = fkc.parent_object_id
inner join
sys.columns c2 ON fkc.referenced_column_id = c2.column_id and c2.object_id = fkc.referenced_object_id
我知道,我得到的設置回來5列的結果。在linq類型的對象或iQueryable對象中存儲這些數據的方法是否靈活有效?我希望能夠通過它來遍歷...
有很多方法。你問哪個ORM最好?這太開放了...... – RedFilter
你使用EF/Linq2SQL嗎?或「純」的ADO.NET? – Yahia