Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Unspecified error using ado command to update a varchar max field Expand / Collapse
Author
Message
Posted Sunday, July 27, 2014 10:03 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 8, 2014 1:23 PM
Points: 6, Visits: 79
Hello... I posted this a couple of days ago on the "anything that is not SQL" forum but had no luck so I thought I'd try here... Sorry but it's a bit more of a front-end question, I'm just hoping someone here has seen it before and knows where to look.

Original message is as follows:

This is a tricky one, and my first post to this forum so appollogies if I'm in the wrong place.

We have a SQL Server 2008 database for handling help desk calls. When necessary the users will paste the entire contents of an email into a text box on the main form. This can sometimes include graphics etc. which get stripped. The email client is Outlook 2007 and the frontend is built in MS Access and uses ADO (2.8) commands to handle updates. The backend parameter and field is varchar(max).

The problem is that, occasionally, when the user clicks save they get an unspeciifed error occurring on the command.execute line.

This problem can't be reproduced on the dev machines which run with Office 2003.

We managed to isolate a single character that produces the error every time in a 2007 environment. This character is ASCII 234, looks like a "|" or sometimes "ê" depending on font etc.

I have tried stripping all characters with an ASCII code greater than 128. This makes no difference. Also tried changing to nvarchar and this didn't help either.

Anyone seen this before or have any idea what might be causing it?

Thanks

Mark
Post #1596631
Posted Tuesday, July 29, 2014 1:50 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Today @ 1:06 AM
Points: 69, Visits: 251
If your update is not parameterised, the problem could be due to occasional single quote characters in the input, eg.

Update MyTable set Surname = 'O' Connor'

The update statement would terminate at the quote in the middle of the surname leaving the remainder of the line as an invalid SQL statement.
Post #1597176
Posted Tuesday, July 29, 2014 2:19 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 8, 2014 1:23 PM
Points: 6, Visits: 79
The update is of course parameterised. The issue only occurs on some machines (possibly all 2007, haven't proved it though).

Cheers
Post #1597184
Posted Tuesday, July 29, 2014 9:00 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 8, 2014 1:23 PM
Points: 6, Visits: 79
Looks like this is something to do with how wingding characters are handled when copied from an email into an Access text box. The main cause seems to be the symbols for a computer and a phone in email sigs. If you select one and paste it into the immediate window you get a space in Access 2007 and a bracket in 2003...

Loads of fun ;o)
Post #1597342
Posted Wednesday, July 30, 2014 2:56 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 8, 2014 1:23 PM
Points: 6, Visits: 79
For anyone who gets the same issue:

It appears that when you paste into an Access 2007 text box you retain some of the formatting tags that normally get stripped when pasting to a plain text field. Access 2007 now supports rich text in the standard text box so I guess, even when set to plain text, it is retaining some data that throws an error when passed into an ADO command.

To fix this issue I simply iterate the characters in the string, creating a new string based on the ASCII values. This drops whatever it is that causes the error.

Cheers
Post #1597619
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse