Formatting IPv6 as an int in C# and storing it in SQL Server

前端 未结 5 2215
无人及你
无人及你 2020-12-15 05:00

Under IPv4 I have been parsing the string representation of IP addresses to Int32 and storing them as INT in the SQL Server

5条回答
  •  臣服心动
    2020-12-15 05:42

    If you are using SQL Server 2005, you can use the uniqueidentifier type. This type stores 16 bytes, which is perfect for an IPv6 ip address. You can convert between IPAddress and Guid by using the constructors and ToByteArray.

提交回复
热议问题