Bhavesh Vankar

Bhavesh Vankar

  • 753
  • 1.2k
  • 89.3k

Age find using DOB in textbox vb6.0

Apr 12 2021 8:31 AM
when i use below query to find age using birth date it generate error as per below...
error
 
THE CONVERSION OF A VARCHAR DATA TYPE TP A DATETO,E DATA TYPE RESULTED IN AN OUT-OF-RANGE VALUE.
 
my code as per below..
i want to find age and display in textbox using entering DOB in textbox....
i have implement as per below... whats wrong kindly suggest....
  1. If rs.state = adStateOpen Then rs.Close  
  2. rs.Open "Select DATEDIFF(YEAR,CONVERT(datetime,'" & txtBirthdate.Text & "',103),CONVERT(varchar,V_ISSUEDATE,103)) from MASTER_NEW", cn.Conn, adOpenDynamic, adLockOptimistic  
  3. txtAge.Text = rs("V_AGE") & ""  
 

Answers (11)