Recordset.value Property

See below DDL:

CREATE TABLE TestDate (bookingdate datetime) INSERT INTO TestDate VALUES ('2013-10-04') 

The following is a list of ADODB entries:

 rs.open "SELECT bookingdate FROM TestDate" If rs("bookingdate") > dateadd("yyyy", -6, Now) msgbox("test") end if 

What is the difference between rs("bookingdate") and rs("bookingdate").value . I read a few questions here, where respondents say they always use .value, but this is not explained why. I looked at MSDN but could not find an answer.

0
vb6
05 Oct '13 at 17:08
source share
1 answer

Value is the default property of the Field object, so in VB6 there is no difference between rs("bookingdate") and rs("bookingdate").value when used without Set .

I personally prefer not to use default properties that don't accept parameters. This makes the code less confusing IMO.

In VB.NET, the default property must have a parameter, so this situation does not occur.
Note A Recordset has such a default property with a parameter, and you use it to return a Field object: rs("bookingdate") is actually rs.Item("bookingdate") . Using those IMO is not harmful.

+1
Oct 05 '13 at 17:18
source share



All Articles