Einzelnen Beitrag anzeigen

ph0

Registriert seit: 17. Mai 2007
40 Beiträge
 
#26

Re: eintrag zur db hinzufügen und auslesen

  Alt 12. Jun 2007, 16:53
ändert sich nicht stoppt da immer noch...


Delphi-Quellcode:
begin
  result:=-1;
  if aName<>'then
    begin
      for i:=0 to FieldsCount-1 do
        if not CaseSensitive then
          begin
            if uppercase(FieldDef(i).Name)=uppercase(aName) then
              begin
                result:=i;
                break;
              end;
          end
        else
          if FieldDef(i).Name=aName then
            begin
              result:=i;
              break;
            end;
    end;
end;

////////////////////////////////////////////////////////////////////////////////
// returns the value of a field with a specific name or nil if there is no field with that name
//note: there may be fields with nil value ... so do not take the result as there is no field with that name
function TMysqlResult.FieldValueByName(aName: string;
  CaseSensitive: boolean): pchar;
begin
  result:=FieldValue(FieldIndexByName(aName,CaseSensitive));
end;

end.
bei mir siehts so aus:
Delphi-Quellcode:
 q:='Select (`nname`, `vname`)'+' From '+'(`user`)'+' WHERE '+'(`id=1`)';
  FResult:= FMysql.query(q, true, ex);

  label19.caption:=(fresult.FieldvalueByName('nname')+ ', ' + fresult.FieldValueByName('vname'));
EDIT:wenn ich allerding das ausführe klappts....
Delphi-Quellcode:
    q:='Select (`id`)'+' From '+'(`user`)';
    FResult:= FMysql.query(q, true, ex);
    anzahl:=strtoint(fresult.FieldValueByName('id'))+1;
  Mit Zitat antworten Zitat