在c#中比較sql server的數據類型和ms訪問

[英]comparing data type of sql server and ms access in c#


Is there any method to compare the data types of two different Databases.

有沒有方法可以比較兩個不同數據庫的數據類型。

1 个解决方案

#1


5  

Jet Engine (Access) | Sql-Server                          | C#
--------------------+-------------------------------------+--------------------
Text (len < 256)    | char, nchar, varchar, nvarchar      | string
Memo                | text, ntext, the above with len>255 | string
Byte                | tinyint                             | byte
Integer             | smallint                            | short
Long Integer        | integer (int)                       | int
Single              | real                                | float
Double              | float                               | double
Replication ID      | uniqueidentifier                    | Guid
Decimal             | decimal                             | decimal
Date/Time           | smalldatetime, datetime, datetime2  | DateTime
Binary     (8 bytes)| timestamp, rowversion (Since V2008) | byte[]    (8 bytes)
Currency            | smallmoney, money                   | decimal
AutoNumber          | int + identity property             | int
Yes/No              | bit                                 | bool
OLE Object          | image                               | byte[]
Hyperlink           | <no equivalent>                     | string
<no equivalent>     | binary, varbinary                   | byte[]

I took this information from How to Migrate from Access to SQL Server 2000 and added the c# column.

我從如何從Access遷移到SQL Server 2000中獲取此信息並添加了c#列。

Note also that most types are nullable in the databases. Map nullable columns to Nullable<T> (T?) in C# unless the .NET type is a reference type.

另請注意,大多數類型在數據庫中都可以為空。除非.NET類型是引用類型,否則將可空列映射到C#中的Nullable (T?)。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/12/10/1923bbb3b945bf8bc3a990c99207b581.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com