OleDB Get SQL Server SmallDateTime type.
使用OLEDBCommand 读取的table schema并不支持SQL Server 一些特殊的数据类型,例如SmallDateTime. 可以通过查找 INFORMATION_SCHEMA.COLUMNS 获得SQLServer里的数据类型。
OleDbCommand cmd = new OleDbCommand("select * from tablename", con);
OleDbDataReader rd = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)
DataTable schemaTb = rd.GetSchemaTable(); // schemaTb里面的column type只是OleDB 支持的类型
cmd.CommandText = "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = tablename and COLUMN_NAME = columnName";
这样能得到column在SQL Server里的真实类型。
当然,如果一开始就是使用 System.Data.SqlClient,就不存在这个问题。
OleDB Get SQL Server SmallDateTime type.相关推荐
- SQL Server中的列存储索引
先决条件 (Prerequisite ) 通过理论和实践措施可以更好地解释与SQL Server 2012列存储索引有关的讨论. 因此,对于实际测量部分–我将使用AdventureWorksDW201 ...
- SQL Server数据类型概述
In this article, we will give an overview of various SQL Server data types. 在本文中,我们将概述各种SQL Server数据 ...
- Sql Server 连接池及其用法
其实我们一直在使用SqlServer的连接池.在连接字符串中,Pooling为是否启用连接池,默认值为true,表示启用. 与连接池相关的两个重要参数是 Min Pool Size和 Max Pool ...
- 今天在webcasts上看sql server 2008的新功能介绍,无意中发现在连接sql server 数据库时,还有一个...
今天在webcasts上看sql server 2008的新功能介绍,无意中发现在连接sql server 数据库时,还有一个 Failover Partner的选项.以前都没注意过,它的主要功能就是 ...
- SQL Server Junior Database Administrator方案相关的访谈问答
In this article, we will discuss a number of questions that you may be asked when applying to a juni ...
- SQL Server中的文件流
This article will discuss SQL Server FILESTREAM including installation, configuration, enabling and ...
- SQL Server中的空间SQL数据类型
空间数据类型 (Spatial data type) SQL server furnishes us with the geometry and geography SQL data types fo ...
- 了解SQL Server中的GUID数据类型
什么是GUID? (What is a GUID?) GUID is a 16 byte binary SQL Server data type that is globally unique acr ...
- Microsoft SQL Server Management Studio(SSMS)概述
介绍 (Introduction) Microsoft SQL Server Server Management is an advanced development environment that ...
最新文章
- 使用ListView应该注意的地方 很全
- 图表添加特定横轴数据_Excel图表学习61: 编写一个给多个数据系列添加趋势线的加载宏...
- php controller 间调用,php – 在CodeIgniter中的另一个Controller中调用Controller函数
- [luoguP1640] [SCOI2010]连续攻击游戏(二分图最大匹配)
- SSRS 使用(1)建立简单的Report
- jquery attr()和prop()方法的区别
- stringstream字符串流的妙用
- 劲爆ORACLE优化,你不必是专家
- 20191001:String,StringBuffer,StringBuilder类异同辨析
- Objective-C ---JSON 解析 和 KVC
- vue前端动态分页模板(记录)
- ubuntu 安装php 扩展和查看扩展包
- cefsharp作为采集工具(学习笔记)
- windows安装python3步骤_windows下python3第三方库安装方法总结
- Java 读取p12 证书私钥
- ydui的datetime日期选择组件
- 王阳明:致良知就是让你成为真正的自己
- 极简文艺的浏览器主页推荐,无广告,文艺又清新的网址导航
- Linux自动巡检脚本
- 如何使用jQuery和CSS创建万花筒
热门文章
- 让你的网站从http免费升级为https
- oracle分区系统视图,ORACLE 分区表 相关视图
- ultraos win10启动盘_用UltraISO把Win10 ISO镜像写入U盘制作系统安装盘
- B/S C/S 三层体系结构
- 八个commit让你学会爬取京东商品信息
- phpstudy php调试,phpStudy vscode 搭建debug调试的教程详解
- pdf 文件格式及对象模型
- android opencv hdr,用 OpenCV 进行高动态范围(HDR)成像
- python小鱼_Python 入门第五天
- 牛客-丢手绢(尺取)