sys.tables 和 sys.procedures 是否有 C# API? [英] Is there a C# API for sys.tables and sys.procedures?

查看:27
本文介绍了sys.tables 和 sys.procedures 是否有 C# API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我从头开始编写自己的版本之前,是否有将 SQL Server 中的系统视图(例如 sys.tables 和 sys.procedures)暴露给 C# 的 API?

解决方案

正如您所建议的,您可以使用 ADO.NET 来查询 系统目录.

您也可以使用 LINQ to SQL:

  • 在 Visual Studio 中打开服务器资源管理器.打开与服务器的连接.

  • 右键单击服务器并选择更改视图">对象类型".

  • 在系统表和用户表下,您可以将系统对象拖到 .dbml 表面上.

<小时>

对于特定于数据库的对象,请使用 SMO(SQL Server 管理对象)

在 C# 中添加 Microsoft.SqlServer.Management.Smo

SQL Server 管理对象 (SMO) 编程指南

这可能有用:参考 Microsoft.SqlServer.Smo.dll

Before I run off and write my own version from scratch, is there an API that exposes the system views in SQL Server (e.g. sys.tables and sys.procedures) to C#?

解决方案

As you suggest, you can use ADO.NET to query the system catalogs.

You could also use LINQ to SQL:

  • Open Server Explorer in Visual Studio. Open a connection to the server.

  • Right-click the server and choose Change View > Object Type.

  • Under System Tables and User Tables, you can drag a system object onto a .dbml surface.


For database specific objects use SMO (SQL Server Management Objects)

In C# add Microsoft.SqlServer.Management.Smo

SQL Server Management Objects (SMO) Programming Guide

This might be of use: Reference Microsoft.SqlServer.Smo.dll

这篇关于sys.tables 和 sys.procedures 是否有 C# API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆