Jump to content

abdellahmehdi

Members
  • Content Count

    33
  • Joined

  • Last visited

Posts posted by abdellahmehdi


  1. On 8/20/2022 at 7:07 PM, Rangga said:
    
    Server=(LocalDb)\MSSQLLocalDB
    DriverID=MSSQL
    ODBCAdvanced=AttachDbFileName=C:\Dir\Dir\TestDB.mdf
    Database=MyDatabase

    Please can you explain more?


  2. Just now, Remy Lebeau said:

    You have 2 StrToDate() calls in that highlighted code (presumably more offscreen?), both are converting scGPDBDateEdit11.Text.  Your earlier screenshot show the Text is '  /  /  ', which is obviously NOT a valid date string, which is why StrToDate() raises EConvertError. 

    It should work just fine, eg:

    
    if TryStrToDate(scGPDBDateEdit11.Text, mydate) then begin
      // use mydate as needed...
    end else begin
      // do something else...
    end;

     

    Thanks bro


  3. Just now, Remy Lebeau said:

    If you are converting the Text of the "né" control to a TDate/TDateTime using StrToDate(), consider using TryStrToDate() instead.  That would avoid the EConvertError being raised.  Just make sure you pay attention to its return value to know if the conversion was successful or not.

     

    Personally, I would use a TDateTimePicker or TDatePicker instead.  For instance, TDateTimePicker as a built-in CheckBox that can be used to indicate whether a date has been entered. 

    where,s the error Knowing that  didn't work for me TryStrToDate

    Screenshot (38).png

×