While adding the data to clone datatable using below code.
i getting on error. can tell how to add max length as -1 in the linq
(From r In Out_Dt.AsEnumerable()
Let va = r.ItemArray
Assign: Cannot set column ‘Col1’. The value violates the MaxLength limit of this column.
Hi Shyam ,
It appears that you are trying to copy the contents of a DataTable (
Out_Dt) to another DataTable (
Dt_New). However, you are encountering an error because one of the values from the
Out_Dt exceeds the
MaxLength property of the corresponding column in
To resolve this issue, you should make sure that the
MaxLength property of the columns in
Dt_New are either set to
-1 (which means no limit) or set to a value that is equal to or greater than the maximum length of the corresponding columns in
You could reconfigure Dt_New Columns before usage
before the query use this
Hi @ppr @Shiva_Nikhil @AutomationX_by_Kiran
First : Get the data from sql server (using Query) stored Out_Dt
Second : Convert the all the columns datatype into System.Object in for each activity.
Thrid : After converted All columns datatype to object… try add values from (Out_Dt) while adding the values i got error in Col1 MaxLenth Limit of this Columns.
We cannot change datatype of Column if data exists in the column.
The above workflow doesn’t change data type of columns of Out_Dt because ForEach iterates Out_Dt.Clone
For now, can you try to add
Dt_Out.Columns("RQ_VALUE").MaxLength = -1 just before the Assign of the LINQ?
I have 126 Columns cant able mention individual columns Name one by one. so that can i use one more for each activity to iterate the all the columns max length as -1
How about the following?
It may not be necessary If activity. (To make sure, the above sample change max length in only string type)