alexs писал(а):FBDataSet и UIBQuery - это...
Буквально вчера и то т то "пощупал". alexs-у большой спасибо за FBDataSet. Очень толково сделано. Одного не понял...
Как передать/присвоить значения параметрам (Params) компонента tUIBQuery?
Модератор: Модераторы
alexs писал(а):FBDataSet и UIBQuery - это...

procedure DoSaveRow;
begin
  rxSmsData.First;
  while not rxSmsData.Eof do
  begin
    quSaveRow.Params.ByNameAsInteger['tb_file_packet_id']:=PacketId;
    quSaveRow.Params.ByNameAsString['tb_file_packet_row_sms_text']:=GetFormatedSMS;
    quSaveRow.Params.ByNameAsString['tb_file_packet_row_phone']:=rxSmsData.Fields[0].AsString;
    quSaveRow.ExecSQL;
    rxSmsData.Next;
  end;
end;

alexs писал(а):Всё понятно?


dunin писал(а):unitsql.pas(97,48) Error: No member is provided to access property

 
   
   
  

alexs писал(а):Как я люблю такие сообщения об ошибках
...
 
 function InsSQL  (Base:tIBConnection; TableName: string; FieldsName: array of string; NewValues: array of variant; DoCommitRetaining: boolean = True): boolean;
  var iSQL: tSQLQuery;
      S: string; I: Integer;
begin
  if (Length(FieldsName) <> Length(NewValues))
    then begin
      raise Exception.Create(sql001+' InsSQL');
      exit;
    end;
  iSQL:= tSQLQuery.Create(Base);
  iSQL.DataBase:= Base;
  iSQL.Transaction:= Base.Transaction;
  iSQL.SQL.Add('insert into '+TableName+' ');
  S:='';
  for I:= 0 to High(FieldsName)
    do S:= S + TableName+'.'+FieldsName[i]+',';
  SetLength(S, Length(S)-1);
  iSQL.SQL.Add('('+S+') values ');
  S:='';
  for I:= 0 to High(NewValues)
    do S := S+':'+IntToStr(i)+',';
  SetLength(S, Length(S)-1);
  iSQL.SQL.Add('('+S+')');
  for I:= 0 to High(NewValues)
    do iSQL.Params.ParamByName(inttostr(i)).Value:= NewValues[i];
  try
    iSQL.ExecSQL;
    if DoCommitRetaining then Base.Transaction.CommitRetaining;
  finally
    iSQL.Close;
    FreeAndNil(iSQL);
    Base.Transaction.Active:=True;
  end;//finally
Result:= True;
end;   function InsSQL  (Base:TJvUIBDataBase; TableName: string; FieldsName: array of string; NewValues: array of variant; DoCommitRetaining: boolean = True): boolean;
  var iSQL: tJvUIBQuery;
      //iSQL: tFBDataSet;
      S: string; I: Integer;
begin
  if (Length(FieldsName) <> Length(NewValues))
    then begin
      raise Exception.Create(sql001+' InsSQL');
      exit;
    end;
  iSQL:= tJvUIBQuery.Create(Base);
  //iSQL:= tFBDataSet.Create(Base);
  iSQL.DataBase:= Base;
  //iSQL.Transaction:= Base.Transaction;
  iSQL.SQL.Clear; // ?????
  iSQL.SQL.Add('insert into '+TableName+' ');
  S:='';
  for I:= 0 to High(FieldsName)
    do S:= S + TableName+'.'+FieldsName[i]+',';
  SetLength(S, Length(S)-1);
  iSQL.SQL.Add('('+S+') values ');
  S:='';
  for I:= 0 to High(NewValues)
    do S := S+':'+IntToStr(i)+',';
  SetLength(S, Length(S)-1);
  iSQL.SQL.Add('('+S+')');
  for I:= 0 to High(NewValues)
    do iSQL.Params.ByNameAsVariant[inttostr(i)]:= NewValues[i]; // <-- здесь не работает !!!!!!
  try
    iSQL.ExecSQL;
    //if DoCommitRetaining then Base.Transaction.CommitRetaining;
  finally
    iSQL.Close;
    //iSQL.Free;
    FreeAndNil(iSQL);
    //Base.Transaction.Active:=True;
  end;//finally
Result:= True;
end;      
  UIBQuery1.Params.ByNameAsVariant[IntToStr(i)]:='aaa';






dunin писал(а):Где можно взять одним файлом версию FBDataSet совместимую с последней версией UIB (которая без Jv префиксов)?


Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 1