Hi
Still I have not got the solution.
I created the function as you suggested
Code:
Public Function IsDBNull(ByVal dbvalue) As Boolean
Return dbvalue Is DBNull.Value
End Function
And I am using that function to check whether the data that I have read is NULL or not
Code:
Dim BirthDate as new Date
Dim memberConnection As New NpgsqlConnection(StudentSpace.Global.ConString)
Dim memberCommand As NpgsqlCommand
Dim memberReader As NpgsqlDataReader
id = uId
memberCommand = New NpgsqlCommand("select BirthDate from Student where UserID=:ID", memberConnection)
memberCommand.Parameters.Add(":ID", NpgsqlTypes.NpgsqlDbType.Integer).Value = id
memberConnection.Open()
memberReader = memberCommand.ExecuteReader()
memberReader.Read()
If Not IsDBNull(memberReader.GetDateTime(0)) Then ' Ur Function Call
BirthDate = memberReader.GetDateTime(0)
End If
Then also I am getting the error
Error is Object cannot be cast from DBNull to other types.
What should I do
Bookmarks