uniqueidentifier in SQL becomes lower case in c#
If you using Entity Framework, uniqueidentifier data will convert to Guid.
The value of this Guid, represented as a series of lowercase hexadecimal digits in the specified format.
If you need consistency in your application you can use one format when you get string out of Guid.
Check Guid.ToString Method (String) for available formats
There can be a place where you get guid as string from database so that will be infinity upper case. ( check stored procedures Views etc..)
To avoid this issue you have to make sure that return uniqueidentifier as it is, don't convert to varchar and also follow one stranded format when converting to string.
For other operations like comparing etc..You can use Guid operators..
Guid.NewGuid().ToString() returns string in lower case; and in SQL server, SELECT NEWID() returns string in upper case. Why is that?如果要把字符串的guid转换为字节数组的话,可以先进行parse,然后再tobytearray
https://docs.microsoft.com/en-us/dotnet/api/system.guid.parse?view=netframework-4.7.2
https://docs.microsoft.com/en-us/dotnet/api/system.guid.tobytearray?view=netframework-4.7.2
guid的字节序问题
uniqueidentifier in SQL becomes lower case in c#的更多相关文章
- 你真的会玩SQL吗?Case也疯狂
你真的会玩SQL吗?系列目录 你真的会玩SQL吗?之逻辑查询处理阶段 你真的会玩SQL吗?和平大使 内连接.外连接 你真的会玩SQL吗?三范式.数据完整性 你真的会玩SQL吗?查询指定节点及其所有父节 ...
- sql中对于case when...then...else...end的写法和理解
查询配件主数据表(tbl_part_base_info)的所有数据和配件是否有物料(物料表(tbl_material)中有配件主数据表的part_no,就表示有物料,反之,则表示没有物料),用sql中 ...
- Leetcode#709. To Lower Case(转换成小写字母)
题目描述 实现函数 ToLowerCase(),该函数接收一个字符串参数 str,并将该字符串中的大写字母转换成小写字母,之后返回新的字符串. 示例 1: 输入: "Hello" ...
- 转载:SQL中的case when then else end用法
SQL中的case when then else end用法 来源: http://www.cnblogs.com/prefect/p/5746624.html Case具有两种格式.简单Case函数 ...
- Eclipse upper case/lower case
How do I make a lower case string in Eclipse to be upper case?Using Eclipse, I want to select a stri ...
- 【Leetcode】709. To Lower Case
To Lower Case Description Implement function ToLowerCase() that has a string parameter str, and retu ...
- 【Leetcode_easy】709. To Lower Case
problem 709. To Lower Case solution1: class Solution { public: string toLowerCase(string str) { stri ...
- LeetCode--To Lower Case && Remove Outermost Parentheses (Easy)
709. To Lower Case(Easy)# Implement function ToLowerCase() that has a string parameter str, and retu ...
- 709. To Lower Case - LeetCode
Question 709. To Lower Case Sollution 题目大意:字符串大写转小写 思路: 直接调用Java API函数 字符串转char数组,遍历数组,判断如果大写就转小写 Ja ...
随机推荐
- 学习php必须要了解的一些知识
前言:每个人的成功都是用辛勤的劳动换来的 一.网络的基础知识 IP地址:Internet protocol address 指的是互联网协议地址,由二进制构成,(IPV4是32位的二进制),我们人为的 ...
- MongoDB save()方法和insert()方法的区别
MongoDB save()方法和insert()方法的区别 首先看官方文档怎么说的 Updates an existing document or inserts a new document, d ...
- SQL.Cookbook 读书笔记3 操作多个表
第三章 操作多个表 表连接的内连接和外连接 A表 B表id name id name 1 a 1 b 2 b 3 c4 c内连接就是左表和右表相同的数据,查询结果只有相等的数据:select * fr ...
- CODEVS 必做题:3149、2821、1531、3369、1230
3149 爱改名的小融 2 时间限制: 2 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题解 题目描述 Description Wikioi上有个人叫小融,他喜 ...
- 《从零开始学Swift》学习笔记(Day 33)——属性观察者
原创文章,欢迎转载.转载请注明:关东升的博客 为了监听属性的变化,Swift提供了属性观察者.属性观察者能够监听存储属性的变化,即便变化前后的值相同,它们也能监听到. 属性观察者主要有以下两个: l ...
- The Intriguing Obsession
C. The Intriguing Obsession time limit per test 1 second memory limit per test 256 megabytes input s ...
- #1589 : 回文子串的数量(Manacher)
#1589 : 回文子串的数量 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定一个字符串S,请统计S的所有|S| * (|S| + 1) / 2个子串中(首尾位置不 ...
- Xamarin.Forms学习之XAML命名空间
大家好,我又悄咪咪的来了,在上一篇的Xamarin文章中简单介绍了Xamarin的安装过程,妈蛋没想到很多小朋友很感激我,让他们成功的安装了Xamarin,然后......成功的显示了经典的两个单词( ...
- 密钥管理服务KMS
密钥管理服务 KMS - 腾讯云 https://cloud.tencent.com/product/kms
- QThread与多线程(比较清楚)
QThread类为我们提供了一种平台无关的管理线程的方式.一个QThread对象管理应用程序中的一个线程,该线程从run()函数开始执行.并且,默认情况下,我们可以在run()函数中通过调用QThre ...