Click here to Skip to main content
14,303,339 members
Rate this:
Please Sign up or sign in to vote.
See more:
The code below can not read the value of field "BIRTH_DATE" giving conversing error
vl = InputBox("PLS,ENTER THE STAFF'S FILE_NO TO UPDATE")
       Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=c:\Users\BELLCONSULT\Documents\COUNCILS.mdb"
       Dim cn As OleDb.OleDbConnection = New OleDb.OleDbConnection(strConnection)
       cn.Open()
       Dim db As New OleDb.OleDbCommand("select * from PERSONAL_DATA where F_NO =" & Val(vl), cn)
       Dim rdr As OleDb.OleDbDataReader = db.ExecuteReader()
       rdr.Read()
       If rdr.HasRows Then
           fn = rdr.Item("F_NO")
           sm = rdr.Item("STAFF_SURNAME")
           nm = rdr.Item("STAFF_OTHERNAME")
           sx = rdr.Item("SEX")
           db = rdr.Item("BIRTH_DATE")
           rdr.Close()
       End If


Please help me out
[Edit - SHOUTING removed]
Posted
Updated 22-May-13 5:01am
v2

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

you have declared
Dim db As New OleDb.OleDbCommand("select * from PERSONAL_DATA where F_NO =" & Val(vl), cn)

and later on you are reading same
db = rdr.Item("BIRTH_DATE")

how this can be possible...so chage it to
dim dt as Date= rdr.Item("BIRTH_DATE")
   
v3
Comments
adesewa 23-May-13 12:05pm
   
thanks for the observation.d problem is solved

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100