D
Dan Sikorsky
How can I get the recordset attributes for a table field in SQL Server 2000
to report the field updatable attribute correctly ... mine keeps saying the
fields are not updatable? That is, ( oRecordSet ( oItem ).Attributes & 0x4)
is always 0 for every field on SQL Server 2000
Example code:
var sSQL = 'SELECT TOP 1 * FROM [' + sTableName + '] WHERE ' + sUniqueField
+ '=' + sUniqueValue + ';';
oRecordSet.Open ( sSQL, oConnection, adOpenStatic, adLockOptimistic );
// get the data from the form, updating the recordset
var e = new Enumerator ( Request.Form );
while ( !e.atEnd ( ) )
{
var oItem = e.item();
if ( ( oRecordSet ( oItem ).Attributes & 0x4) != 0 ) // 4 ==
adFldUpdatable, 8 == adFldUnknownUpdatable
{
oRecordSet ( oItem ).Value = ( FixNull( Request.Form( oItem ) ) == '' ?
null : Request.Form ( oItem ));
// if the unique field was updated use the new answer
if ( oItem == sUniqueField )
{
// keep it wrapped in "" if it used to be
if ( sUniqueValue.charAt ( 0 ) == "'" )
sUniqueValue = "'" + Request.Form ( oItem ) + "'";
else
sUniqueValue = "" + Request.Form ( oItem );
}
}
}
e.moveNext ( );
}
oRecordSet.Update ( );
to report the field updatable attribute correctly ... mine keeps saying the
fields are not updatable? That is, ( oRecordSet ( oItem ).Attributes & 0x4)
is always 0 for every field on SQL Server 2000
Example code:
var sSQL = 'SELECT TOP 1 * FROM [' + sTableName + '] WHERE ' + sUniqueField
+ '=' + sUniqueValue + ';';
oRecordSet.Open ( sSQL, oConnection, adOpenStatic, adLockOptimistic );
// get the data from the form, updating the recordset
var e = new Enumerator ( Request.Form );
while ( !e.atEnd ( ) )
{
var oItem = e.item();
if ( ( oRecordSet ( oItem ).Attributes & 0x4) != 0 ) // 4 ==
adFldUpdatable, 8 == adFldUnknownUpdatable
{
oRecordSet ( oItem ).Value = ( FixNull( Request.Form( oItem ) ) == '' ?
null : Request.Form ( oItem ));
// if the unique field was updated use the new answer
if ( oItem == sUniqueField )
{
// keep it wrapped in "" if it used to be
if ( sUniqueValue.charAt ( 0 ) == "'" )
sUniqueValue = "'" + Request.Form ( oItem ) + "'";
else
sUniqueValue = "" + Request.Form ( oItem );
}
}
}
e.moveNext ( );
}
oRecordSet.Update ( );