SqlException:Cannot create a row of size X which is greater than m

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I get the error:

Unhandled Exception: System.Data.SqlClient.SqlException: Cannot create a row
of size 9168 which is greater than the allowable maximum of 8060.
The statement has been terminated.
......
at ECS.DBWriter.DBWriter.DBUpdate()

I am using the following code:

this.da = new SqlDataAdapter(sql, this.cn);
this.da.FillSchema(this.ds, SchemaType.Mapped, this.dataTableName);
this.da.SelectCommand = new SqlCommand(sql, cn);
SqlCommandBuilder cb = new SqlCommandBuilder(this.da);
this.dt = this.ds.Tables[this.dataTableName];

..... insert ....

updateCount = this.da.Update(this.ds, this.dataTableName); <= crash

The code crahses here.
Because I use FillSchema, I know the length of my columns and do not insert
more data [it would fail at insert].

What could be the reasn for the error-message and how should I handle this??
My table is large enough for my data!! One of my columns was set to 4000
characters and I tried to reduce it to 3600; But the behavios remains the
same.

Thanks so far and
best regards,
Manfred Braun
Mannheim
Germany
 
Ok, start a profiler trace and see what's actually getting sent.
I suspect you're pushing the envelope though. Most database designs that
have this problem are not properly normalized.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
The problem is the amount of data you are trying to insert in one row is
over 8060.

You might want to convert some the varchar 4000 to a text field.
 
Hello All,

and thanks for the help. I thought it: According to
http://support.microsoft.com/kb/260418/en-us there is really this little
amount of data, Ado.Net can transfer.

Additionally, I forget to count my "varchar(4000)" as 8000 bytes .... ;-)

Best regards,

Manfred

Marina said:
The problem is the amount of data you are trying to insert in one row is
over 8060.

You might want to convert some the varchar 4000 to a text field.

Manfred Braun said:
Hi All,

I get the error:

Unhandled Exception: System.Data.SqlClient.SqlException: Cannot create a
row
of size 9168 which is greater than the allowable maximum of 8060.
The statement has been terminated.
.....
at ECS.DBWriter.DBWriter.DBUpdate()

I am using the following code:

this.da = new SqlDataAdapter(sql, this.cn);
this.da.FillSchema(this.ds, SchemaType.Mapped, this.dataTableName);
this.da.SelectCommand = new SqlCommand(sql, cn);
SqlCommandBuilder cb = new SqlCommandBuilder(this.da);
this.dt = this.ds.Tables[this.dataTableName];

.... insert ....

updateCount = this.da.Update(this.ds, this.dataTableName); <= crash

The code crahses here.
Because I use FillSchema, I know the length of my columns and do not
insert
more data [it would fail at insert].

What could be the reasn for the error-message and how should I handle
this??
My table is large enough for my data!! One of my columns was set to 4000
characters and I tried to reduce it to 3600; But the behavios remains the
same.

Thanks so far and
best regards,
Manfred Braun
Mannheim
Germany
 
Back
Top