Home All Groups Group Topic Archive Search About

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

Author
20 Nov 2005 9:45 PM
Manfred Braun
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

Author
21 Nov 2005 12:52 AM
William (Bill) Vaughn
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.
__________________________________

Show quote
"Manfred Braun" <ManfredBr***@discussions.microsoft.com> wrote in message
news:98BD4D4E-7426-42F2-B29A-4307151D222F@microsoft.com...
> 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
>
Author
21 Nov 2005 2:38 PM
Marina
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.

Show quote
"Manfred Braun" <ManfredBr***@discussions.microsoft.com> wrote in message
news:98BD4D4E-7426-42F2-B29A-4307151D222F@microsoft.com...
> 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
>
Author
22 Nov 2005 7:52 PM
Manfred Braun
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

Show quote
"Marina" <someone@nospam.com> wrote in message
news:O1laNlq7FHA.4076@tk2msftngp13.phx.gbl...
> 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" <ManfredBr***@discussions.microsoft.com> wrote in message
> news:98BD4D4E-7426-42F2-B29A-4307151D222F@microsoft.com...
> > 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
> >
>
>

AddThis Social Bookmark Button