Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not a valid time format?
#1
Hi,

We  have moved to new servers.

OS Name Microsoft Windows Server 2016 Standard
Delphi 10.3.3
Intraweb 15.2.3
TMS Intraweb 5.9.10
Using Interbase 2017
Firedac components.

I can't see anything wrong with the  date format. Can you?

The problem is that we in on one of the forms we get:

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.


in 99.99% . (sometimes we succeeds to get a result set showing in the TMSgrid.)

Error details:

Exception message : '2020-06-29 12:29:03.4500' is not a valid date and time
Depending on the error condition, it might be possible to restart the application.
Exception class : EConvertError
Exception address : 0676A8F6
Exception Time : 2020-06-29 12:29:36.995
------------------------------------------------------------------------------------------------------------------------
Application Name : isapiXIBwwd.dll
Application Version: 1.0.0.0
Started at : 2020-06-29 12:14:05.802
Running for : 15 minutes 31 seconds
Computer Name : P-W-WWD-WEB01
Compiler Version : 330
------------------------------------------------------------------------------------------------------------------------
IntraWeb Version : 15.2.3
Multi-session : False
Content Path : d:\wwwroot\customerzone.opuscapita.com\wwd\wwwroot\
Session count : 21
Application Path : d:\wwwroot\customerzone.opuscapita.com\wwd\
Active Form : frmWWD (TfrmWWD)
Active Form list : [1] frmLogon (TfrmLogon)
[2] frmWWD (TfrmWWD)
Form list : [1] IWUserSession (TIWUserSession)
[2] frmLogon (TfrmLogon)
[3] frmWWD (TfrmWWD)
Browser Name : Chrome
Browser UserAgent : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Session ID : cPWEejrIa55X0GvdS6Y23OGmkNG
Last Access : 2020-06-29 12:29:36.157
Callback : False
Runtime parameters :
------------------------------------------------------------------------------------------------------------------------
Client IP address : ::1
Request PathInfo : /
Request Method : POST
Request User Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Cookies Count : 1
Reply
#2
I think you need to turn on the exception logger on your application so we will know where it is happening.

http://docs.atozed.com/docs.dll/developm...ogger.html

Have a look at this document. Enable the exception logger and the stack trace. It will show us where it is happening.

Regarding your date/time format, yes, it can be wrong depending on your system settings.
Reply
#3
(07-02-2020, 06:28 AM)Alexandre Machado Wrote: I think you need to turn on the exception logger on your application so we will know where it is happening.

http://docs.atozed.com/docs.dll/developm...ogger.html

Have a look at this document. Enable the exception logger and the stack trace. It will show us where it is happening.

Regarding your date/time format, yes, it can be wrong depending on your system settings.

ok done.

I can't add attachemnt : The type of file that you attached is not allowed. Please remove the attachment or choose a different type.

so I paste it here instead.
------------------------------------------------------------------------------------------------------------------------
Exception message  : '2020-12-29' is not a valid date
Depending on the error condition, it might be possible to restart the application.
Exception class    : EConvertError
Exception address  : 0638A8F6
Exception Time    : 2020-07-02 11:17:27.893
------------------------------------------------------------------------------------------------------------------------
Application Name  : isapiXIBwwd.dll
Application Version: 1.0.0.0
Started at        : 2020-07-02 10:56:39.379
Running for        :  20 minutes 48 seconds
Computer Name      : P-W-WWD-WEB01
Compiler Version  : 330
------------------------------------------------------------------------------------------------------------------------
IntraWeb Version  : 15.2.3
Multi-session      : False
Content Path      : d:\wwwroot\customerzone.opuscapita.com\wwd\wwwroot\
Session count      : 20
Application Path  : d:\wwwroot\customerzone.opuscapita.com\wwd\
Active Form        : frmUserDetail_3 (TfrmUserDetail)
Active Form list  : [1] frmLogon (TfrmLogon)
                    [2] frmStart (TfrmStart)
                    [3] frmWWD (TfrmWWD)
                    [4] frmUsers (TfrmUsers)
                    [5] frmUserDetail (TfrmUserDetail)
                    [6] frmUsers_1 (TfrmUsers)
                    [7] frmUserDetail_1 (TfrmUserDetail)
                    [8] frmUsers_2 (TfrmUsers)
                    [9] frmUserDetail_2 (TfrmUserDetail)
                    [10] frmUsers_3 (TfrmUsers)
                    [11] frmUserDetail_3 (TfrmUserDetail)
Form list          : [1] IWUserSession (TIWUserSession)
                    [2] frmLogon (TfrmLogon)
                    [3] frmStart (TfrmStart)
                    [4] frmWWD (TfrmWWD)
                    [5] frmUsers (TfrmUsers)
                    [6] frmUserDetail (TfrmUserDetail)
                    [7] frmUsers_1 (TfrmUsers)
                    [8] frmUserDetail_1 (TfrmUserDetail)
                    [9] frmUsers_2 (TfrmUsers)
                    [10] frmUserDetail_2 (TfrmUserDetail)
                    [11] frmUsers_3 (TfrmUsers)
                    [12] frmUserDetail_3 (TfrmUserDetail)
Browser Name      : Chrome
Browser UserAgent  : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36
Session ID        : f6FdcIQHEibs4-1jR7UvUsOJnxG
Last Access        : 2020-07-02 11:17:27.181
Callback          : False
Runtime parameters :
------------------------------------------------------------------------------------------------------------------------
Client IP address  : 172.26.95.100
Request PathInfo  : /
Request Method    : POST
Request User Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36
Cookies Count      : 1
------------------------------------------------------------------------------------------------------------------------
(000298F1){isapiXIBwwd.dll} [0638A8F1] System.SysUtils.Sysutils.ConvertErrorFmt$qqrp20System.TResStringRecpx14System.TVarRecxi + $19
(0003086B){isapiXIBwwd.dll} [0639186B] System.SysUtils.Sysutils.StrToDate$qqrx20System.UnicodeStringrx31System.Sysutils.TFormatSettings + $2F
(0000A098){isapiXIBwwd.dll} [0636B098] System.@UStrClr$qqrpv + $1C
(003BC112){isapiXIBwwd.dll} [0671D112] Data.DB.Db.TDateTimeField.SetAsString + $32
(0002FEA7){isapiXIBwwd.dll} [06390EA7] System.SysUtils.Sysutils.FormatDateTime$qqrx20System.UnicodeString16System.TDateTimerx31System.Sysutils.TFormatSettings + $13
(007FEA86){isapiXIBwwd.dll} [06B5FA86] UserDetail.TfrmUserDetail.FormToDb (Line 470, "UserDetail.pas" + 10) + $4D
(007FD61A){isapiXIBwwd.dll} [06B5E61A] UserDetail.TfrmUserDetail.btnSparaClick (Line 281, "UserDetail.pas" + 11) + $2
(002C7EC4){isapiXIBwwd.dll} [06628EC4] IWBaseControl.TIWBaseControl.DoClick (Line 256, "IWBaseControl.pas" + 2) + $A
(003E5F20){isapiXIBwwd.dll} [06746F20] IWAdvToolButton.TTIWAdvToolButton.Submit (Line 395, "IWAdvToolButton.pas" + 4) + $4
(00305008){isapiXIBwwd.dll} [06666008] IWForm.TIWForm.DoExecuteForm (Line 1197, "IWForm.pas" + 119) + $6
(0032A0FA){isapiXIBwwd.dll} [0668B0FA] IWBaseForm.TIWBaseForm.ExecuteForm (Line 510, "IWBaseForm.pas" + 9) + $5
(00331EEF){isapiXIBwwd.dll} [06692EEF] IWApplication.TIWApplication.ExecuteActiveForm (Line 1528, "IWApplication.pas" + 34) + $2
(00331B70){isapiXIBwwd.dll} [06692B70] IWApplication.TIWApplication.ProcessForm (Line 1405, "IWApplication.pas" + 9) + $7
(00358C7D){isapiXIBwwd.dll} [066B9C7D] IWServerSession.TIWServerSession.ExecuteForm$qqrv (Line 863, "IWServerSession.pas" + 11) + $9
(0035849E){isapiXIBwwd.dll} [066B949E] IWServerSession.TIWServerSession.DoExecuteSession$qqrx20System.UnicodeStringo (Line 749, "IWServerSession.pas" + 80) + $2
(00358AF5){isapiXIBwwd.dll} [066B9AF5] IWServerSession.TIWServerSession.ExecuteSession$qqrx20System.UnicodeString (Line 832, "IWServerSession.pas" + 52) + $7
(00344EFA){isapiXIBwwd.dll} [066A5EFA] IWServer.TIWServer.ExecuteUrl (Line 678, "IWServer.pas" + 90) + $6
(0034544C){isapiXIBwwd.dll} [066A644C] IWServer.TIWServer.Execute (Line 752, "IWServer.pas" + 17) + $6
(00355433){isapiXIBwwd.dll} [066B6433] IWServerSession.HttpExecute$qqrpuci (Line 91, "IWServerSession.pas" + 2) + $3
(0033FC54){isapiXIBwwd.dll} [066A0C54] IW.ISAPI.Extension.Isapi.Extension.TIWIsapiExtension.ExecuteHook (Line 286, "IW.ISAPI.Extension.pas" + 4) + $C
(0033FA68){isapiXIBwwd.dll} [066A0A68] IW.ISAPI.Extension.Isapi.Extension.TIWIsapiExtension.HandleRequest (Line 264, "IW.ISAPI.Extension.pas" + 5) + $13
(0035A5E4){isapiXIBwwd.dll} [066BB5E4] IWInitISAPI.HttpExtensionProc$qqsr38Winapi.Isapi2.TEXTENSION_CONTROL_BLOCK (Line 224, "IWInitISAPI.pas" + 9) + $3
(0035A89C){isapiXIBwwd.dll} [066BB89C] IW.Isapi.ThreadPool.Isapi.Threadpool.WorkerFunction$qqrp38Iw.Isapi.Threadpool.TIWISAPIThreadPool (Line 88, "IW.Isapi.ThreadPool.pas" + 12) + $3
(00009F2C){isapiXIBwwd.dll} [0636AF2C] System.ThreadWrapper$qqspv + $28

------------------------------------------------------------------------------------------------------------------------
Reply
#4
Is there a control attached to a TField? If so, which control class is this?
Reply
#5
(07-02-2020, 09:54 AM)Alexandre Machado Wrote: Is there a control attached to a TField? If so, which control class is this?

No


This was the one in error

Code:
procedure TfrmUserDetail.FormToDb;
var
  ExpPeriod:Integer;
  aDatePwe: TDateTime;
begin

  if (UserSession.UserMode = 0)  then begin  { Insert }
  ExpPeriod:=StrToInt(UserSession.ReadProfileValue('SYSTEM', 'PW', 'PWEXPPER', '0')); {Expiration period in days }
    aDatePwe:=incDay(Now,ExpPeriod);
    UserSession.FDQryUsersMod.Insert;
    UserSession.FDQryUsersMod.FieldByName('UserID').AsString              := AnsiUppercase(inpUID.Text);
    UserSession.FDQryUsersMod.FieldByName('PartID').AsInteger              := UserSession.UsersSelectedPartId;
    UserSession.FDQryUsersMod.FieldByName('Uppldat').AsString              := FormatDateTime('c',now);
    UserSession.FDQryUsersMod.FieldByName('PwStatus').AsString              := '0';  { Normal }
    UserSession.FDQryUsersMod.FieldByName('PwExpirationDate').AsString      := FormatDateTime('yyyy-mm-dd',aDatePwe);
    UserSession.FDQryUsersMod.FieldByName('PwChangeDate').Clear;
  end
  else begin
    UserSession.FDQryUsersMod.Edit;
    if (UserSession.SysUser) then begin                                  { Allowed to move a user from one part to another }
      UserSession.FDQryUsersMod.FieldByName('PartID').AsInteger            := StrToInt(inpCompany.Items.ValueFromIndex[inpCompany.ItemIndex]);
    end;
  end;
  UserSession.FDQryUsersMod.FieldByName('Enamn').AsString                  := inpEnamn.Text;
  UserSession.FDQryUsersMod.FieldByName('Fnamn').AsString                  := inpFnamn.Text;
  UserSession.FDQryUsersMod.FieldByName('Tel').AsString                    := inpTel.Text;
  UserSession.FDQryUsersMod.FieldByName('Fax').AsString                    := inpFax.Text;
  UserSession.FDQryUsersMod.FieldByName('Email').AsString                  := AnsiLowerCase(inpEmail.Text);
  UserSession.FDQryUsersMod.FieldByName('PW').AsString                      := inpuPw.Text;
  UserSession.FDQryUsersMod.FieldByName('Funktion').AsString                := inpFunction.Items.ValueFromIndex[inpFunction.ItemIndex];
  UserSession.FDQryUsersMod.FieldByName('Anddat').AsString                  := FormatDateTime('c',now);
  UserSession.FDQryUsersMod.FieldByName('Mobnr').AsString                  := inpMob.Text;
  UserSession.FDQryUsersMod.FieldByName('WWDAUTH_eConnectivity').AsBoolean  := False;
  UserSession.FDQryUsersMod.FieldByName('WWDAUTH_eConnectivity').AsBoolean  := cbxeConnectivity.Checked;
  UserSession.FDQryUsersMod.FieldByName('WWDAUTH_Company').AsBoolean        := False;
  UserSession.FDQryUsersMod.FieldByName('WWDAUTH_Company').AsBoolean        := cbxCompany.Checked;
  UserSession.FDQryUsersMod.FieldByName('TestUser').AsBoolean              := False;
  UserSession.FDQryUsersMod.FieldByName('TestUser').AsBoolean              := cbxTestUser.Checked;
  UserSession.FDQryUsersMod.FieldByName('CompanyAdmin').AsBoolean          := False;
  UserSession.FDQryUsersMod.FieldByName('CompanyAdmin').AsBoolean          := cbxCompanyAdmin.Checked;

end;
Reply
#6
(07-02-2020, 10:11 AM)or Mikael Nilsson Wrote:
(07-02-2020, 09:54 AM)Alexandre Machado Wrote: Is there a control attached to a TField? If so, which control class is this?

No

This is the code in error

procedure TfrmUserDetail.DbToForm;
var
  i:Integer;
begin
  inpUID.Text:= AnsiLowerCase(UserSession.FDQryUsersMod.FieldByName('UserID').AsString);
  inpEnamn.Text:= UserSession.FDQryUsersMod.FieldByName('Enamn').AsString;
  inpFnamn.Text:= UserSession.FDQryUsersMod.FieldByName('Fnamn').AsString;
  inpTel.Text:= UserSession.FDQryUsersMod.FieldByName('Tel').AsString;
  inpFax.Text:= UserSession.FDQryUsersMod.FieldByName('Fax').AsString;
  inpEmail.Text:= UserSession.FDQryUsersMod.FieldByName('Email').AsString;
  inpuPw.Text:= UserSession.FDQryUsersMod.FieldByName('PW').AsString;
  if (UserSession.FDQryUsersMod.FieldByName('Funktion').AsString = 'A') then begin
    inpFunction.ItemIndex:=0;
  end
  else begin
    inpFunction.ItemIndex:=1;
  end;
  lblCD.Caption:='Last change date: ' + UserSession.FDQryUsersMod.FieldByName('AndDat').AsString;
  inpMob.Text:=UserSession.FDQryUsersMod.FieldByName('Mobnr').AsString;
  cbxeConnectivity.Checked:=UserSession.FDQryUsersMod.FieldByName('WWDAUTH_eConnectivity').AsBoolean;
  cbxCompany.Checked:=UserSession.FDQryUsersMod.FieldByName('WWDAUTH_Company').AsBoolean;
  cbxTestUser.Checked:=UserSession.FDQryUsersMod.FieldByName('TestUser').AsBoolean;
  cbxCompanyAdmin.Checked:=UserSession.FDQryUsersMod.FieldByName('CompanyAdmin').AsBoolean;
end;

Sorry wrong procedure.

This was the one in error

procedure TfrmUserDetail.FormToDb;
var
  ExpPeriod:Integer;
  aDatePwe: TDateTime;
begin

  if (UserSession.UserMode = 0)  then begin  { Insert }
  ExpPeriod:=StrToInt(UserSession.ReadProfileValue('SYSTEM', 'PW', 'PWEXPPER', '0')); {Expiration period in days }
    aDatePwe:=incDay(Now,ExpPeriod);
    UserSession.FDQryUsersMod.Insert;
    UserSession.FDQryUsersMod.FieldByName('UserID').AsString              := AnsiUppercase(inpUID.Text);
    UserSession.FDQryUsersMod.FieldByName('PartID').AsInteger              := UserSession.UsersSelectedPartId;
    UserSession.FDQryUsersMod.FieldByName('Uppldat').AsString              := FormatDateTime('c',now);
    UserSession.FDQryUsersMod.FieldByName('PwStatus').AsString              := '0';  { Normal }
    UserSession.FDQryUsersMod.FieldByName('PwExpirationDate').AsString      := FormatDateTime('yyyy-mm-dd',aDatePwe);
    UserSession.FDQryUsersMod.FieldByName('PwChangeDate').Clear;
  end
  else begin
    UserSession.FDQryUsersMod.Edit;
    if (UserSession.SysUser) then begin                                  { Allowed to move a user from one part to another }
      UserSession.FDQryUsersMod.FieldByName('PartID').AsInteger            := StrToInt(inpCompany.Items.ValueFromIndex[inpCompany.ItemIndex]);
    end;
  end;
  UserSession.FDQryUsersMod.FieldByName('Enamn').AsString                  := inpEnamn.Text;
  UserSession.FDQryUsersMod.FieldByName('Fnamn').AsString                  := inpFnamn.Text;
  UserSession.FDQryUsersMod.FieldByName('Tel').AsString                    := inpTel.Text;
  UserSession.FDQryUsersMod.FieldByName('Fax').AsString                    := inpFax.Text;
  UserSession.FDQryUsersMod.FieldByName('Email').AsString                  := AnsiLowerCase(inpEmail.Text);
  UserSession.FDQryUsersMod.FieldByName('PW').AsString                      := inpuPw.Text;
  UserSession.FDQryUsersMod.FieldByName('Funktion').AsString                := inpFunction.Items.ValueFromIndex[inpFunction.ItemIndex];
  UserSession.FDQryUsersMod.FieldByName('Anddat').AsString                  := FormatDateTime('c',now);
  UserSession.FDQryUsersMod.FieldByName('Mobnr').AsString                  := inpMob.Text;
  UserSession.FDQryUsersMod.FieldByName('WWDAUTH_eConnectivity').AsBoolean  := False;
  UserSession.FDQryUsersMod.FieldByName('WWDAUTH_eConnectivity').AsBoolean  := cbxeConnectivity.Checked;
  UserSession.FDQryUsersMod.FieldByName('WWDAUTH_Company').AsBoolean        := False;
  UserSession.FDQryUsersMod.FieldByName('WWDAUTH_Company').AsBoolean        := cbxCompany.Checked;
  UserSession.FDQryUsersMod.FieldByName('TestUser').AsBoolean              := False;
  UserSession.FDQryUsersMod.FieldByName('TestUser').AsBoolean              := cbxTestUser.Checked;
  UserSession.FDQryUsersMod.FieldByName('CompanyAdmin').AsBoolean          := False;
  UserSession.FDQryUsersMod.FieldByName('CompanyAdmin').AsBoolean          := cbxCompanyAdmin.Checked;

end;

To me it appears as if you are trying to add a date or datetime value to a DB field (eg. UserSession.FDQryUsersMod.FieldByName('Uppldat').AsString := FormatDateTime('c',now); ).

You are using .AsString in the assignment, converting the value to a string. Is the field you are trying to fill, a string (varchar) or date / Datetime (smalldate) ? If it is a date, you cannot assign a datevalue as a string. The assign will try to add the text '2020-12-29', including the hyphens, to a datetime field. Thus the error.

Use .AsDate or AsDateTime instead and do not convert value to a text.

Regards
Soren
Reply
#7
if I changed it to this
UserSession.FDQryUsersMod.FieldByName('Uppldat').AsDateTime            := FormatDateTime('c',now);

I get a compiler error

[dcc32 Error] UserDetail.pas(470): E2010 Incompatible types: 'TDateTime' and 'string'
Reply
#8
(07-02-2020, 01:59 PM)Mikael Nilsson Wrote: if I changed it to this
UserSession.FDQryUsersMod.FieldByName('Uppldat').AsDateTime            := FormatDateTime('c',now);

I get a compiler error

[dcc32 Error] UserDetail.pas(470): E2010 Incompatible types: 'TDateTime' and 'string'

Yes, because FormatDateTime('c',now) generates a string. try to just set it to := now;
Reply
#9
Also you can use .value in the assign:

UserSession.FDQryUsersMod.FieldByName('UserID').value := AnsiUppercase(inpUID.Text);
UserSession.FDQryUsersMod.FieldByName('PartID').value := UserSession.UsersSelectedPartId;
UserSession.FDQryUsersMod.FieldByName('Uppldat').value := now;

.value is a genetic type which will add the value as it is assigned, as long as the assigned and the assignee types are the same.
Reply
#10
(07-02-2020, 03:31 PM)SorenJensen Wrote: Also you can use .value in the assign:

UserSession.FDQryUsersMod.FieldByName('UserID').value            := AnsiUppercase(inpUID.Text);
UserSession.FDQryUsersMod.FieldByName('PartID').value              := UserSession.UsersSelectedPartId;
UserSession.FDQryUsersMod.FieldByName('Uppldat').value            := now;

.value is a genetic type which will add the value as it is assigned, as long as the assigned and the assignee types are the same.

Thanks for the tip but my way of coding is working in Delphi 10.3.2 but not in Delphi 10.3.3
Also  text string is showing dates like this 05/01/2020 instead of 2020-05-01
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)