Patch for TZASAResultSet

Code patches written by our users to solve certain "problems" that were not solved, yet.

Moderators: gto, cipto_kh, EgonHugeist, mdaems

Ostfriese
Junior Boarder
Junior Boarder
Posts: 25
Joined: 12.05.2009, 10:48
Location: Coburg
Contact:

Patch for TZASAResultSet

Postby Ostfriese » 15.05.2009, 13:54

I've modified the UpdateUnicodeString procedure to avoid a compiler warning claiming a dangerous typecast

Code: Select all

procedure TZASAResultSet.UpdateUnicodeString(ColumnIndex: Integer; const Value: WideString);
begin
  PrepareUpdateSQLData;
  //HA 090515 fix dangerous typecast
  //FUpdateSqlData.UpdatePChar( ColumnIndex, PChar( Value));
  FUpdateSqlData.UpdatePChar( ColumnIndex, PChar( PWideChar(Value)));
end;
Thomas Jefferson wrote:Information ist die Währung der Demokratie

User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Postby mdaems » 20.05.2009, 22:20

Would this also be solved using the construct we used to get Testing branch compiled on D2009?

Code: Select all

procedure TZASAResultSet.UpdateUnicodeString(ColumnIndex: Integer; const Value: WideString);
begin
  PrepareUpdateSQLData;
  FUpdateSqlData.UpdatePChar(ColumnIndex, PAnsiChar(string(Value)));
end;


Mark
Image

paripalu
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 28.08.2010, 09:06

Postby paripalu » 28.08.2010, 09:11

You can't call ToString on a null reference in C#, it throws a NullReferenceException.
You would need to do this:
Object o = cmd.ExecuteScalar();
if(o != null)
ss = o.ToString();
else
// Not Found code here.
==================
Best Life Insurance | Buy Life Insurance


Return to “User Patches”

Who is online

Users browsing this forum: No registered users and 1 guest