惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Schneier on Security
Schneier on Security
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
A
About on SuperTechFans
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
V2EX - 技术
V2EX - 技术
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
V
Visual Studio Blog
Martin Fowler
Martin Fowler
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
F
Full Disclosure
Scott Helme
Scott Helme
H
Heimdal Security Blog
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V
Vulnerabilities – Threatpost
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
Jina AI
Jina AI
S
Securelist
小众软件
小众软件
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
博客园 - 三生石上(FineUI控件)
量子位

博客园 - 朱小能

C#对Dictionary的按Value排序 linq to sql中的自动缓存(对象跟踪) javascript 调用webservice 的几种方法 修改域名映射IP地址 SQL 语句,类型转换 hyper-v 网络连接 VS2010 定位文件在solution中的位置 oracle连接字符串配置 spool的简单使用 open数据库Timeout expired 错误 文件的还原与备份 - 朱小能 - 博客园 ASCII码,对应e.KeyChar C# 调用计算器,日历 - 朱小能 - 博客园 Excel 如何由一个文本算术公式得到一个结果 Word、Excel中输入当前日期及时间的快捷键 c# ToString 格式化数字 - 朱小能 GridView绑定 Filelog - 朱小能 - 博客园 List<T> 排序 - 朱小能 - 博客园
获取access中表的相关信息
朱小能 · 2009-07-01 · via 博客园 - 朱小能

就用到两条.net自带的获取数据库信息的语句

OleDbConnection con = new OleDbConnection(connection); // OleDB数据库连接实例

// 获取数据库中表的相关信息
DataTable dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new Object[] { null, null, null, "Table" });

// 获取Contract表中列的相关信息
 DataTable dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new Object[] { null, null, "Contract", null });

sql server中需要sql语句: 

1.获取所有用户名:
SELECT name FROM Sysusers
where status='2' and islogin='1'
islogin
='1'表示帐户
islogin
='0'表示角色
status
='2'表示用户帐户
status
='0'表示糸统帐户
2.获取所有数据库名:
SELECT Name FROM Master..SysDatabases ORDER BY Name
3.获取所有表名
SELECT Name FROM
DatabaseName..SysObjects Where XType='U' ORDER BY Name
XType
='U':表示所有用户表;
XType
='S':表示所有系统表;
4.获取所有字段名:
SELECT Name FROM SysColumns WHERE id
=Object_Id('TableName')
5.获取数据库所有类型
select name from systypes
6.获取主键字段
SELECT   name FROM SysColumns WHERE id
=Object_Id('表名') and colid=(select top 1 keyno from sysindexkeys where id=Object_Id('表名'))

7、获取字段类型

select a.name as [column],b.name as type from syscolumns a,systypes b where a.id=object_id('表名') and a.xtype=b.xtype
或者可以通过存储过程
exec sp_help 表名

8、取表结构

select column_name,data_type,character_maximum_length from information_schema.columns where table_name = '表名'