MHDMarkei
asked on
How can I set ANSI-WARNINGS OFF using DELPHI and ADO for a connection
I am working on a DELPHI5 application that was ported from SQL 2000 to 2005. There are a huge number of INSERT/UPDATE statements explicitly coded within the application using TADOQuery as well as updates being performed via DBGRIDS etc. The application is experiencing a number of run-time errors due to strings exceeding the defined capacity which I am aware is due to ANSI-WARNINGS ON. How can I easily overcome this with the minimum of coding change? Is there a something that can be done as part of the Connection string or after connection that would apply to all SQL executed within? or do I have to bite the bullett and change all SQL accordingly? I've experimented with running a stored procedure to SET ANSI-WARNINGS OFF after connection but this has not worked. Help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry... edit to previous post... that query fired at the server must of course be SET ANSI_WARNINGS OFF, not ON!
Also as a comment: in general, I personally recommend leaving warnings ON and fixing any underlying causes, but that may not be an option in your situation.
Also as a comment: in general, I personally recommend leaving warnings ON and fixing any underlying causes, but that may not be an option in your situation.
Put a Try except clause?
Try
<code here>
Except
//blank
end;
You'll still get errors when running from the ide but from a compiled app you shouldn't.
Try
<code here>
Except
//blank
end;
You'll still get errors when running from the ide but from a compiled app you shouldn't.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I object... There are several answers and a couple good ones.
Without further clarification of why nothing provided any assistance from the asker, then this Q should not be just closed with points refunded.
John
Without further clarification of why nothing provided any assistance from the asker, then this Q should not be just closed with points refunded.
John
Repeated...
I object... There are several answers and a couple good ones.
Without further clarification of why nothing provided any assistance from the asker, then this Q should not be just closed with points refunded.
John
I object... There are several answers and a couple good ones.
Without further clarification of why nothing provided any assistance from the asker, then this Q should not be just closed with points refunded.
John
He split the points...he's not asking for a refund anymore.
Force accepted.
modus_operandi
EE Moderator
modus_operandi
EE Moderator
I believe this needs to be done on the database itself but I could be wrong.
The only time i have ever seen it done is via a query that is running a stored procedure on the database. But this obviously means the SQL is at database level and not within an application.