MSSQL与Delphi类型对照一览表 【转】

例:
Case DBGrid1.DataSource.DataSet.Fields.FieldByName(字段名).DataType of
ftBCD: //对应MSSql数据库的decimal、money、numeric、smallmoney类型
end;

//其它的请看下面
TFieldType is a set of values that parallel the data types of fields in tables.
Unit
DB
type TFieldType = (ftUnknown, ftString, ftSmallint, ftInteger, ftWord, ftBoolean, ftFloat, ftCurrency, ftBCD, ftDate, ftTime, ftDateTime, ftBytes, ftVarBytes, ftAutoInc, ftBlob, ftMemo, ftGraphic, ftFmtMemo, ftParadoxOle, ftDBaseOle, ftTypedBinary, ftCursor, ftFixedChar, ftWideString, ftLargeint, ftADT, ftArray, ftReference, ftDataSet, ftOraBlob, ftOraClob, ftVariant, ftInterface, ftIDispatch, ftGuid);

Value Sql Description

ftUnknown Unknown or undetermined
ftString char Character or string field
ftSmallint smallint 16-bit integer field
ftInteger int 32-bit integer field
ftWord tinyint 16-bit unsigned integer field
ftBoolean bit Boolean field
ftFloat float、real Floating-point numeric field
ftCurrency Money field
ftBCD decimal、money、 Binary-Coded Decimal field
numeric、smallmoney
ftDate Date field
ftTime Time field
ftDateTime datetime、smalldatetime Date and time field
ftBytes binary、timestamp Fixed number of bytes (binary storage)
ftVarBytes varbinary Variable number of bytes (binary storage)
ftAutoInc Auto-incrementing 32-bit integer counter field
ftBlob image Binary Large OBject field
ftMemo text Text memo field
ftGraphic Bitmap field
ftFmtMemo Formatted text memo field
ftParadoxOle Paradox OLE field
ftDBaseOle dBASE OLE field
ftTypedBinary Typed binary field
ftCursor Output cursor from an Oracle stored procedure (TParam only)
ftFixedChar Fixed character field
ftWideString nchar、nvarchar Wide string field
ftLargeInt bigint Large integer field
ftADT Abstract Data Type field

ftArray Array field
ftReference REF field
ftDataSet DataSet field
ftOraBlob BLOB fields in Oracle 8 tables
ftOraClob CLOB fields in Oracle 8 tables
ftVariant sql_variant Data of unknown or undetermined type
ftInterface References to interfaces (IUnknown)
ftIDispatch References to IDispatch interfaces
ftGuid uniqueidentifier globally unique identifier (GUID) values

查看类型的好方法

1)、在Delphi集成开发环境中建立一个新的应用程序项目。
2)、在主窗体中放入一个TADOTable组件。并且设定好它的ConnectionString属性以及从TableName属性中选择一个表。
3)、选择TADOTable组件,并且双击它,然后在弹出的Fields Editor窗口中单击鼠标右键选择Add All Fields菜单。这时会把所有字段都例举出来,然后任意选中一个你要查看类型的字段,在属性编辑器中就可以看到Ms Sql转换后的类型(图1)。我们看到的类型是TBytesField对应的就是ftBytes,以此类推。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值