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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With