Q&A

  • [팁] ASP구현에서의 session 넣기.
//아직 개발중이라 정확하지 않은 소스입니다만 작동은 됩니다.



procedure Tmusac101.SaveUserCD;

Var iusr_id,iusr_name,iusr_depart,iusr_pwd,iusr_admin,iLogIn_ID,iLogIn_IP: String;

begin

iLogIn_ID := Session['LogIn_ID'];

iLogIn_IP := Session['LogIn_IP'];



iusr_id := Trim(Request.Form.Item['usr_id']);

iusr_name := Trim(Request.Form.Item['usr_name']);

iusr_depart := Trim(Request.Form.Item['usr_depart']);

iusr_pwd := Trim(Request.Form.Item['usr_pwd']);

iusr_admin := Trim(Request.Form.Item['usr_admin']);

with TDM.Create(NIL) do

begin

If Not ADOCnn.Connected Then ADOCnn.Open;

with ADOQry do

begin

Close;

SQL.Clear;

SQL.Add('Select * From UserCD Where usr_id = ''' + iusr_id + ''' ');

Open;

If Eof Then

Begin

Close;

SQL.Clear;

SQL.Add('Insert Into UserCD Values ( ');

SQL.Add('''' + iusr_id + ''', ');

SQL.Add('''' + iusr_name + ''', ');

SQL.Add('''' + iusr_depart + ''', ');

SQL.Add('''' + iusr_pwd + ''', ');

SQL.Add('''' + iusr_admin + ''', ');

SQL.Add('''' + iLogIn_ID + ''', ');

SQL.Add('''' + FormatDateTime('yyyymmdd',now) + ''', ');

SQL.Add('''' + iLogIn_IP + ''', ');

SQL.Add(''''', ');

SQL.Add(''''', ');

SQL.Add(''''' )');

ExecSQL;

End

Else

Begin

Close;

SQL.Clear;

SQL.Add('Update UserCD Set ');

SQL.Add('usr_name = ''' + iusr_name + ''', ');

SQL.Add('usr_depart = ''' + iusr_depart + ''', ');

SQL.Add('usr_pwd = ''' + iusr_pwd + ''', ');

SQL.Add('usr_admin = ''' + iusr_admin + ''', ');

SQL.Add('usr_mod_id = ''' + iLogIn_ID + ''', ');

SQL.Add('usr_mod_ymd = ''' + FormatDateTime('yyyymmdd',now) + ''', ');

SQL.Add('usr_mod_ip = ''' + iLogIn_IP + ''' ');

SQL.Add('Where usr_id = ''' + iusr_id + '''');

ExecSQL;

End;

End;

ADOCnn.Close;

free;

end;

Response.Write(''+#13);

Response.Write(' '+#13);

Response.Write(' '+#13);

Response.Write(' '+#13);

Response.Write(' '+#13);

Response.Write(' '+#13);

Response.Write(''+#13);

end;

0  COMMENTS