0
我需要做一个工具来遍历SQL Server,需要将所有表导出为文本。这是我第一次使用C#和SMO,遇到了一个非常简单的问题。我遍历所有表中的所有列,但不知道如何从列中获取数据,多亏了解朋友的指导,谢谢!使用SMO遍历SQL Server中的所有数据
另外,我的英语水平很一般,这些词都是通过翻译软件翻译的,因此,如果语法有问题,我很抱歉,后悔没有在学校学习英语......
public void EnumDB()
{
foreach (Database db in srv.Databases)//Traverse the database in the instance
{
Console.WriteLine(db.Name);//Print the database name
foreach (Table table in db.Tables)//Traverse the tables in the database
{
Console.WriteLine(table.Name);//Print the table name
foreach (Column col in table.Columns)//Traverse the columns in the table
{
//How to get the data in the column?tks!!
}
}
}
}
你看过文档吗?当然,那里肯定有东西! –
你必须做一个查询。这些对象没有数据的概念。 – Crowcoder
我检查了SMO文档,没有找到并获取有关数据... – yajiang