Free NT Web Hosting, Free ASP Hosting, Free Web hosting, Free Hosting - DomainDLX
    

    Home
    Registration
    FAQs
    Terms of service
    Contact us

    Learn ASP
    Databases
    Articles

Reading and writing is the fun part.  To read a record all you have to do is ask for the values of each field in the current record.  This is done by the ADODB.Field object under the ADODB.RecordSet.Fields collection.  Here is how it works.

[Variable = ]ADODB.Recordset.Fields("FieldName").Value

Example:

UserName = RS.Fields("UserName").Value  'This will set UserName to the value in the current record's UserName field.

You should always call Update before changing the current record.

ADODB.Recordset.Fields("FieldName").Value[ = Value]
ADODB.Recordset.Update

Example:

RS.Fields("UserName") = NewUserName 'This sets the fields UserName to the value in NewUserName
RS.Update        'Saves all changes to the record

Here is that hard part right here, the adding of a new record.  To do this you must use the AddNew method. If your table requires that certain fields be filled before the record can be used, then use the Field and Value parameters in the AddNew method to set that or those field(s).  Then call the Update method to make sure that the new record is the current one and set the other fields as shown above then call Update one last time when finished.

ADODB.Recordset.AddNew FieldName, FieldValue
or
ADODB.Recordset.AddNew FieldNameArray, FieldValueArray

Example:

RS.AddNew "UserName", NewUserName  'Make a new record and set the first field
RS.Update    'Update it to make sure it is the current record
RS.Fields("Password").Value = NewPassword   'Set the other fields
PS.Fields("Abilities").Value = nNewAbilities
RS.Update    'Save the changes by calling update again

By: Matthew Holder