edit a varchar(max) value give me a "String or binary data would be truncated" error


edit a varchar(max) value give me a "String or binary data would be...
Author
Message
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
I have a "Valor" field (varchar(max)) on a "configuraciones" table, I can save the first time some data, but when I try to edit this same data (I find it with a seek and then edit the data and save it), I get an error "String or binary data would be truncated"

I try to alter this with a empty "" string and save it and it give me error anyway

I set debugon on the datasource and I see this:

[Deleted print out --- killed the page Smile]

I not sure if this are a bug, I save some new data (aprox 30000 bytes, with a base64 string from a memorystream of a devexpress grid savelayout method), edit this with some value and the "truncate" error happen :/

I will try with a text field and a fixed varchar value (something like 50000)

Additionally to this when I used the method "SetDebugOn" on my datasource with the 2nd parameter on true (overwritefile) If the file not exist it give me an error. (I not sure if the method have to create the file if it not exist)

Thanks for the great support.

-Fabian

Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
The problem is that you are using AllFields for your concurrency checking and have a MAX field.  If you want to allow this MAX field to be inclusive of the concurrency checking, then you need to use a row version field or time stamp field...which is far better anyway.  You can only take a VarChar(8000) as the max length on concurrency checking for All Fields.

Really if you want to use concurrency checking, you should be using Row Versioning anyway.  Create an integer field in the DB, and then specify this field name in the CRUD settings of the BO.

Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)StrataFrame User (241 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
I have to say Sorry 2 times, 1 for the paste of the debug htm (I doesn't known that it can break the page Sad ) and another for my lack of knowledge about some topics, one of them that I forgive are concurrency stuff Blush



I put a int "RowVersion" field, on the BO set UpdateConcurrencyType to "rowversion" and set RowVersionOrTimestampColumn to "RowVersion" and all worked fine Smile many thanks.



- Fabian
Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Fabian,

Please don't think I was upset in any way!!!  Absolutely no big deal at all.  As for the concurrency, I am glad that you found what you needed...you will be far better off using RowVersion checking versus AllFields anyway!

Jéssica Neves
Jéssica Neves
StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)
Group: Forum Members
Posts: 14, Visits: 102
Hello would like to know how to read binary files from the database using my business object?

 I have already saved binary data, now wanted to know how do I recuperalos sql server?

Link has to help me?
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (2.8K reputation)Strategic Support Team Member (2.8K reputation)Strategic Support Team Member (2.8K reputation)Strategic Support Team Member (2.8K reputation)Strategic Support Team Member (2.8K reputation)Strategic Support Team Member (2.8K reputation)Strategic Support Team Member (2.8K reputation)Strategic Support Team Member (2.8K reputation)Strategic Support Team Member (2.8K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Jéssica.

What have you stored into your binary field? Are you using a Varbinary type? If so, have you customized your BO field to the type you need?
Jéssica Neves
Jéssica Neves
StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)
Group: Forum Members
Posts: 14, Visits: 102
So, I am using VARBINARY(MAX) on SQL Server, and its mapped as a Byte[], I dont know if I have to mark the option Serialize Data or not. I'm not sure. In my database I need to store images, documents, many kinds of files. I just dont know how to recovery it. Do you have any sample like this?

Thanks in advance!
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (2.7K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Take a look at this post and see if it helps: Business object mapper and images
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search