久久久久久久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)
主站蜘蛛池模板: 日日天天 | 亚洲免费在线视频 | 91精品国产91久久久久福利 | 欧美成人黄色小说 | 在线啊v| 一区二区精品在线 | 美女福利网站 | 中文字幕av在线播放 | 亚洲午夜av久久乱码 | 无码国模国产在线观看 | 日本欧美大片 | 精品一区二区三区在线观看 | 一区二区三区欧美在线观看 | 久久伊人影院 | 一区二区三区四区免费观看 | av在线电影网站 | 又爽又黄axxx片免费观看 | 99re在线视频 | 91大神xh98xh系列全部 | 亚洲视频在线播放 | 欧美视频免费在线 | 中文字幕在线看人 | 少妇诱惑av | 一区二区三区四区不卡视频 | www.日韩| 欧美精品久久久久久久久久 | 国产在线视频在线观看 | 伊人精品一区二区三区 | 超碰在线人人 | 欧美国产日韩在线观看 | 婷婷综合色 | 亚洲国产精品一区二区久久 | 免费观看av | 亚洲69p | 欧美激情综合 | 亚洲精品中文字幕 | 国产精品视频免费观看 | 日本高清视频在线播放 | 色久电影 | 国产不卡一区在线观看 | 国产午夜一级 |