久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為什么會話 ID 的性別為“00000000-0000-0000-0000-000

why session id is gendered as #39;00000000-0000-0000-0000-000000000000#39;?(為什么會話 ID 的性別為“00000000-0000-0000-0000-000000000000?)
本文介紹了為什么會話 ID 的性別為“00000000-0000-0000-0000-000000000000"?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

在我的 db 表中,我有一個 PKsessIduniqueidentifier 設置了函數 newid().但是當我插入一條記錄時,sessId 生成為 00000000-0000-0000-0000-000000000000.

In my db table i have a PK column sessId of uniqueidentifier set with the function newid(). But when i insert a record the sessId is generated as 00000000-0000-0000-0000-000000000000.

我認為這是一個系統錯誤,所以我運行 select newid() 它生成了一個新的 id.但是為什么列被插入那些?

I thought this was a system error so i ran select newid() it generated a new id. but why the column gets inserted with those zeros?

推薦答案

發生的情況是您的 SessId 字段是一個 Guid,它是一個值類型,因此必須有一個默認值并且該值全為零.所以當保存到數據庫時,字段上有一個值(全為零)并且不會觸發數據庫默認值.您可以在使用 Guid.NewGuid() 調用 SaveChanges() 之前給 SessId 一個值,并且不要依賴數據庫來執行此操作.或者,如果您可以找到對實體執行此操作的方法,請將字段設為可空的 Guid,以便它以空值到達數據庫.

What is happening is that your SessId field is a Guid which is a value type and therefore must have a default value and that value is all zeros. So when save to the database, there is a value on the field (all zeros) and the database default is not triggered. You can give SessId a value before calling SaveChanges() with Guid.NewGuid() and don't rely on the database to do it. Or, if you can find a way to do it on your entity, make the field a nullable Guid so that it arrives at the database as null.

這篇關于為什么會話 ID 的性別為“00000000-0000-0000-0000-000000000000"?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Modify Existing decimal places info(修改現有小數位信息)
The correlation name #39;CONVERT#39; is specified multiple times(多次指定相關名稱“CONVERT)
T-SQL left join not returning null columns(T-SQL 左連接不返回空列)
remove duplicates from comma or pipeline operator string(從逗號或管道運算符字符串中刪除重復項)
Change an iterative query to a relational set-based query(將迭代查詢更改為基于關系集的查詢)
concatenate a zero onto sql server select value shows 4 digits still and not 5(將零連接到 sql server 選擇值仍然顯示 4 位而不是 5)
主站蜘蛛池模板: 99精品网 | 天天操天天干天天爽 | 亚洲国产精品一区二区第一页 | 精品久久久久久久久久久久 | 中文字幕一区二区三区在线视频 | 中文字幕日韩欧美一区二区三区 | 一级看片免费视频 | 亚洲成人观看 | 久久久免费| 亚洲精品久久久久久下一站 | 欧美lesbianxxxxhd视频社区 | 午夜视频在线 | 亚洲三区在线 | www成人免费视频 | 毛片片 | 欧美一区二区视频 | av免费网站在线观看 | 亚洲精品v | 欧美xxxx黑人又粗又长 | 日韩色视频 | 国产免费福利在线 | 亚洲精品欧美精品 | 青青99| 特级黄一级播放 | 欧美中文字幕在线 | 久久精品视频在线观看 | 亚洲视频中文 | 日韩国产中文字幕 | 国产精品久久久久久久一区二区 | 亚州av | 在线视频一区二区三区 | 一区在线视频 | 午夜精品久久久久久久星辰影院 | 国产欧美一区二区三区日本久久久 | 黄色一级大片在线免费看产 | 日韩欧美在线观看视频 | 亚洲国产成人av好男人在线观看 | 精品国产精品国产偷麻豆 | 无码一区二区三区视频 | 国产日韩精品一区 | 亚洲欧美日韩高清 |