I have a column in SQL varchar(max). Using LINQ, when I'm trying to add a record with a string over 64k large, the value is not saved into DB. I'm simply doing;
test.MyString = LargeString; //(over 64k text)
mydb.myTable.InsertOnSubmit(test);
mydb.SubmitChanges();
Is there a limit when using LINQ to SQL ? What's the correct way to do this?
VarChar(Max)
supports string of upto 8000 characters (SQL Server 2k). On 2005+ this should not cause error.
You may want to use Text
fields; for SQL Server 2005+, VarChar(Max)
is preferred.
Important
ntext, text, and image data types will be removed in a future version of MicrosoftSQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary(max) instead. Fixed and variable-length data types for storing large non-Unicode and Unicode character and binary data. Unicode data uses the UNICODE UCS-2 character set.
See this for details on VarChar & Text data type
I noticed you are calling InsertOnSubmit
on mydb
and calling SubmitChanges
on ISNetDB
- is this typo or cause of the error.
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