"@p5 : Byte array truncation to a length of 8000."

G

Guest

I'm trying to update the data in a DataGridView control.
The underlying data are from SQL Server CE database.
There is an image field in the DataGridView control

when U give the save command, I get the following message.
"@p5 : Byte array truncation to a length of 8000."

Parameter corresponds to the image field. In the parameter, it is displayed
as a Binary.
 
W

WenYuan Wang [MSFT]

Hello rkbnair,

According to your description, you received an error message "@p5: byte
array truncation to a length of 8000" when updating the data in
DataGridView(VS2005). If I misunderstood anything here, please don't
hesitate to correct me.

You may refer to the following document.
http://msdn2.microsoft.com/en-us/library/system.data.sqldbtype.aspx
[SqlDbType Enumeration]
Binary:Array of type Byte. A fixed-length stream of binary data ranging
between 1 and 8,000 bytes.

The maximum length of SqlDbType.Binary is 8000 bytes. Thereby, byte array
will be truncated to a length of 8000.

Because this is an Image Field in DataGridView Control in your case, I
suggest you change the type of Paramter(@p5) as "SqlDbType.Image". Then,
the issue should go away.

Hope this helps. Please try my suggestion and let me know if this is what
you need. If you face any further issue or there is anything unclear,
please feel free to update here again. We are glad to assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Hi,

Thank you so much for the reply. In the development interface, I cannot see
the type sqlDbType.Image for the CE database though.
 
W

WenYuan Wang [MSFT]

Hello Rkbnair,
Thanks for your reply.

Would you please let me know if you are developing desktop Winform
application (or Mobile Winform application)?

I cannot reproduce this issue on my side so far. If it is a desktop Winform
application, is it possible for you to paste the detailed reproduce steps
for me in reply. I will try it on my side again, and reply you as soon as
possible.

If it is a Mobile Winform application, I'm sorry to say we are not support
Smart Device Development issue in Newsgroup. I'd like to suggest you may
post the issue in MSDN forum. Because to special Smart Device Development
issue, the people in those groups will be more likely to be able to help
and familiar in such field.
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=33&SiteID=1
[.NET Compact Framework]
Another choice, you may also post this issue in
Microsoft.public.sqlserver.ce newsgroup. But please notice this
newsgroup(Microsoft.public.sqlserver.ce) is not a managed newsgroup. For
the list of Managed Newsgroups, you may refer to the following document.
http://msdn2.microsoft.com/en-us/subscriptions/aa974230.aspx
[MSDN Managed Newsgroups]

Please let me know what type of application you are developing. I will
follow up. It's my pleasure to assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

WenYuan Wang [MSFT]

Hello Rkbnair,

By the way, if this is a smart device issue, have you tried to specify the
SqlDbType property of SQLParameter?

SqlParameter s = new SqlParameter();
s.SqlDbType = global::System.Data.SqlDbType.Image;

I'm not sure if this method works for you. I just provide some general
information.

Hope this helps.
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Mr. Wang,

Thanks for the reply.

I'm developing a desktop Winform using VB.net.

I still do not see the 'Image' type in the available list.

Thanks.

BTW, can I attach a jpg file along with my postings?
 
W

WenYuan Wang [MSFT]

Hello Rkbnair,
Thanks for your clarifying.
can I attach a jpg file along with my postings?
Yes, you can attach it if you post the reply in OutLook Express.
My alias is (e-mail address removed). You also can send email to me if you
failed to attach it in reply.

I understood it's a Desktop VB.net WinForm application (vs 2005), and the
underlying database is SQL Server 2005 CE.

But I'm sorry to say I cannot reproduce the issue on my side. Because we
don't support Device Development issue in Managed Newsgroup, I haven't
experience in SQL Server 2005 CE database. Therefore, I tried it with SQL
Server 2005 Express database. I created a table, and added a image column
(Type: Image) into it. Then, I added DataSource Reference to this database,
drag-drop it from Data Source Windows into my Winform application Designer
view. I checked the testDBDataSet.Designer.vb file, the type of Paramter is
SQLDbType.Image as below.
Me._adapter.InsertCommand.Parameters.Add(New
Global.System.Data.SqlClient.SqlParameter("@c2",
Global.System.Data.SqlDbType.Image,...))
After running, I did not get error message the parameter will be truncated
to a length of 8000.

Would you please send me a detail reproduce steps (about how you deployed
SQL 2005 CE database, and how you created a desktop WinForm Application
which connected to SQL CE Database)? I will try it on my side, and reply
you as soon as possible.

I'm waiting for your reply. If you have any more concern or there is
anything unclear, please feel free to let me know. It's my pleasure to
assist you.

Have a great day.
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

WenYuan Wang [MSFT]

Hello Rkbnair,

This is Wen Yuan, again. I haven't heard from you a couple of days. Have
you resolved the issue so far?
We haven't met such issue before. We need to reproduce the issue, and then
perform further analyze.
If the issue still persists, would you please provide detailed reproduce
steps for us?

My alias is (e-mail address removed)
If you have any more concern, please also feel free to let me know. We are
glad to assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Mr. Yuan,

Thank you for the update. I have sent an email to you at the following
address:
(e-mail address removed)

In fact, I have created the CE database by following the instructions under
the link http://msdn2.microsoft.com/en-us/library/bb226708.aspx

Also, I did not add a parameter programatically. The parameter was
automatically created when I typed the update command in the data adapter
window.
 
W

WenYuan Wang [MSFT]

Hello R.K.Kanale,

I got your mail. Thanks for your information.

But, I'm afraid to say I still cannot reproduce your issue on my Visual
Studio 2005 sp1 machine. I searched on our internal Database again. I
noticed there is a VS 2008 bug (which is similar to your issue) logged in
our database before. I tried it, get the same exception as yours. The repro
steps as below.

Would you please let me know what development tool you are using?(is it vs
2008?) It seems this issue only occurs on VS 2008. VS 2005 doesn't have
this issue. I have spend about two hours on reproducing this issue on my VS
2005 machine, but failed.

If you are experiencing this issue on VS 2005 sp1. Would you please send me
your project file if it is possible for you? I will try it again. We are
glad to assist you.

Best regards,
Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Reproduce this issue on VS 2008.
1. Open VC# 2008 IDE
2. Create a Windows Form application
3. Add new data source ( Data -> Add new data source)
4. Go through the Data Source config. wizard by selectiong DMicrosoft SQL
Server Compact Edition data source
5. Select the Nortwind database from %programfiles%Microsoft SQL compact
edition\v3.5\samples
6. Choose 'Yes' for copy the file to your project and modify connection
7. Select Tables and click 'Finish'
8. From the data sources Tab drag Category table on the form
9.Run by Clicking F5
10.Nagivate to 4th record and modify the category Name
11. Click on Save Data
 
G

Guest

Mr. Wang,
Thanks for the update. Yes, you are right, I use VS 2008.
Is there any patches been released to fix it?

Thanks.
 
W

WenYuan Wang [MSFT]

Hello R.K.Kanale
Thanks for your reply.

I have found this issue on our internal Database. It appears to be a SQL CE
product issue. They hard code 8000 bytes as the maximum size of a binary
type parameter.

But, please understand I'm not sure whether it will be fixed. The current
version of VS 2008 is beat 2. As far as I know, there is no hotfix for VS
2008 beta. I suggest you may wait until the final RTM version has released.

By the way, because we don't support VS 2008 beta on Managed Newsgroup, you
may also submit a feedback on our product website. Product team engineer
may communicate with you directly on the issue there.
http://connect.microsoft.com/site/sitehome.aspx

Hope this helps. Please let me know if you have any more concern, we are
glad to assist you.

Have a great day
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top