C# how to create a Guid value?

后端 未结 11 2134
旧时难觅i
旧时难觅i 2020-11-27 09:58

One field of our struct is Guid type. How to generate a valid value for it?

11条回答
  •  温柔的废话
    2020-11-27 10:52

    Alternately, if you are using SQL Server as your database you can get your GUID from the server instead. In TSQL:

    //Retrive your key ID on the bases of GUID 
    
    declare @ID as uniqueidentifier
    
    SET @ID=NEWID()
    insert into Sector(Sector,CID)
    
    Values ('Diry7',@ID)
    
    
    select SECTORID from sector where CID=@ID
    

提交回复
热议问题