Question

My C# manipulates ID's read from the Database. Originally, they are stored in CHAR(32) NOT NULL format. (that's the table's primary key)

Once in C#, this is converted to Int32 (logically ?)

But when I need to insert those values back into another table with a similar structure, but where the primary key's type is INT IDENTITY(1, 1) NOT NULL), I (logically) get the following error, as most CHAR(32) are not valid integers :

Input string was not in a correct format.Couldn't store in ID Column. Expected type is Int32.

Assuming that I want to keep the INT type for my target ID column, how should the C# code send the "E6802AA26C748A5A0EDE987384D2C48" to the SQL server for it not to complain that this is not a true Integer ?

Was it helpful?

Solution

E6802AA26C748A5A0EDE987384D2C48 is not an Int32. It's a GUID. You'd need 128 bits to store it, not 32.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top