Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The code below can not read the value of field "BIRTH_DATE" giving conversing error
VB
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

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

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

how this can be possible...so chage it to
VB
dim dt as Date= rdr.Item("BIRTH_DATE")
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900