Q&A

  • [급!!!] asp서버컴포넌트에서 데이터핸들링
델파이5로 asp서버컴포넌트를 만들고있삽니다.



데이터베이스의 필드값들을 html Tabel 레이아웃에 출력을해주어야하는데요



부탁드리겠습니다.



procedure TCoLogin.GetMem;

var

str : TStringList;

i: integer;

begin

with TDataModule2.Create(nil) do

try

ADOQuery3.Close;

ADOQuery3.Parameters.ParamByName('PAB_Name_hangul').Value := Request.QueryString.item['pab_Name_Hangul'];

ADOQuery3.Open;

str := TStringList.Create;

//경로바꾸지말것!

Str.LoadFromFile('C:qwe.html');

ADOQuery4.Open;

for I:=0 to str.count-1 do

begin

SearchAndReplace(str.strings[i],'PA_1',ADOQuery4.FieldByName('PAB_Name_hangul').AsString);

SearchAndReplace(str.Strings[i],'PA_2',ADOQuery4.FieldByName('PAB_Number').AsString);

SearchAndReplace(str.Strings[i],'PA_3',ADOQuery4.FieldByName('PAB_Duty_Code').AsString);

SearchAndReplace(str.Strings[i],'PA_4',ADOQuery4.FieldByName('PAB_Field_Code').AsString);

SearchAndReplace(str.Strings[i],'PA_5',ADOQuery4.FieldByName('PAB_Technology_Code').AsString);

SearchAndReplace(str.Strings[i],'PA_6',ADOQuery4.FieldByName('PAB_Order_Code').AsString);

Response.Write(str.Strings[i]);

end;

ADOQuery4.Close;

ADOQuery3.Close;

finally

Free;

end;

end;



function TCoLogin.SearchAndReplace(sSrc, sLookFor, sReplaceWith: string ): string;

var

nPos,

nLenLookFor : integer;

begin

nPos := Pos(sLookFor, sSrc);

nLenLookFor := Length(sLookFor);

while(nPos > 0)do

begin

Delete( sSrc, nPos, nLenLookFor );

Insert( sReplaceWith, sSrc, nPos );

nPos := Pos( sLookFor, sSrc );

end;

Result := sSrc;

end;





소스가 대충이런데요....원시적인방법으루...(머리가 돌이라.)



고수님들 부탁드리겠습니다.~~~

0  COMMENTS