Page 1 of 1

Patch for TZASAResultSet

Posted: 15.05.2009, 13:54
by Ostfriese
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;

Posted: 20.05.2009, 22:20
by mdaems
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

Posted: 28.08.2010, 09:11
by paripalu
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