Thanks Jan (I new it was something to do with variants) and here are the
results:

1.  $rs->Fields('col1')->{Value} = Variant(VT_EMPTY);
an empty string (same as '')

2.  $rs->Fields('col1')->{Value} = Variant(VT_NULL);
Win32::OLE(0.1101) error 0x80020009: "Exception occurred"
    in PROPERTYPUT "Value" at D:\Perl\ado_rset.pl line 30
OLE exception from "Microsoft Cursor Engine":

Non-nullable column cannot be updated to Null.

3.  $rs->Fields('col1')->{Value} = Variant(VT_DISPATCH);
Win32::OLE(0.1101) error 0x80020003: "Member not found"
    in PROPERTYPUTREF "Value" at D:\Perl\ado_rset.pl line 30

Perhaps I should explain...I am creating an on-the-fly recordset (using ADO's
"Shorthand" method with no underlying Connection object).  The above error (2)
was caused becuase I neglected to specify the field attribute: adFldIsNullable. 
What is most strange is that even though ADO returns 'Non-nullable column cannot
be updated to Null' it does allow (and indeed defaults to) a value of Null for
the column - how bizarre?

Here's the code I use to create the recordset:

$rs = Win32::OLE->new("ADODB.Recordset") 
        or die "Can't create ADODB.Recordset object";
$rs->Fields->Append('col1', adVarChar, 32, adFldIsNullable);

$rs->AddNew;
$rs->Fields('col1')->{Value} = Variant(VT_EMPTY);

All sorted now, thanks!

--
  Simon Oliver

---
You are currently subscribed to perl-win32-users as: [[email protected]]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to