Re: ADO exception with character combination inside string...



On Wed, 20 Sep 2006 20:10:46 +0200, Bo Berglund
<bo.berglund@xxxxxxxxx> wrote:


The rule for database exception seems to be:
- string contains a " character
- Somewhere after the " there is also a : character


Further investigation shows this to be a problem inside the TADOQuery
component. We have used this extensively throughout our application so
we are now in a tight spot...

The test we did was to use the TADOconnection like this (with the
Northwind database):

procedure TForm1.btnModifyClick(Sender: TObject);
var
SQLString: string;
begin
try
SQLString := 'UPDATE Categories SET [Description] = ''' +
edData.Text + ''' WHERE CategoryID = 4';
connADO.ConnectionString := 'Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial
Catalog=Northwind;Data Source=POLARIS';
connADO.Open;
connADO.Execute(SQLString); <== This always works fine.
qryADO.SQL.Clear;
qryADO.SQL.Add(SQLString);
qryADO.ExecSQL; <== This fails for the condition above
connADO.Close;
except
on E: Exception do
MessageDlg('Error:'#13 + E.Message, mtError, [mbOK],0);
end;
end;

The exception message when the error occurs is this:

"Parameter object is improperly defined. Inconsistent or incomplete
information was provided"

Notice that the exception *only* occurs if the edData.Text string
contains somewhere first a " char and later a : char.
In all other cases the text will be stored in the database!

Please help....



.



Relevant Pages

  • Re: Invalid UNC path in my .NET applicaton
    ... I am having problems loading xml stored as a blob in an Oracle ... Exception Details: System.ArgumentException: The UNC path should be of ... System.IO.Path.nGetFullPathHelper(String path, Char[] ... String& newPath) +0 ...
    (microsoft.public.dotnet.framework)
  • Re: xmalloc string functions
    ... char *dup; ... tokis strtokthat takes a string argument instead of using a global. ... better though, would be an exception handling system, namely, we crash only if the out-of-memory exception goes unhandled. ... likely an unwinding handler would silently ignore any previous recursive handlers. ...
    (comp.lang.c)
  • Re: SoapException character encoding
    ... >> display the character. ... In binary format however, this is still the ... The string we're discussing is XML escaped, ... >> exception, ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: finding strings in a text file help
    ... digits and reserved words and then prints them out in order ... > it gets the whole string matches it against the reserved words array ... one character of a potential word in your "s" string. ... a char[] array would do. ...
    (comp.lang.java.help)
  • Re: remove spaces from a string and Complexity
    ... string character by character and copying onto another output string. ... void delchar(char *s, char c) ... I've seen functions written as above, however I'm still a little confused about one point - C passes by value therefore with your above function wouldn't the following behave incorrectly (incorrectly as in not modify the contents referenced by the first parameter but instead modify a copy of it): ...
    (comp.lang.c)