I'm trying to insert Guid into my Asp.net project as a unique identifier. We have defined the table column length to 16. When I insert Data I get an exception: Data is too long - but when I increase the column length, it changes to byte array for guid must be exactly 16 bytes long.
I have tried adding Data thru NHibernate. The database server is MySQL, column data type is :- BINARY and length is :- 16
public class Myapp
public Guid Id { get; set; }
We write code for getting Data from Cs page:
Myapp.Id =Guid.NewGuid();
How can I solve this?
解决方案
If you are using SQL Server there is a type for a Guid value uniqueidentifier