Ado Property in ASP
In Classic ASP, when working with ADO (ActiveX Data Objects), properties are attributes of ADO objects like Connection, Recordset, or Command that define their behavior or provide information.
? Common ADO Properties in ASP
1. Connection Object Properties
| Property | Description |
|---|---|
.ConnectionString | The connection string used to connect to the DB |
.State | Returns connection state (0=closed, 1=open) |
.Timeout | Time in seconds before connection times out |
Response.Write "Connection State: " & conn.State2. Recordset Object Properties
| Property | Description |
|---|---|
.EOF | True if cursor is past the last record |
.BOF | True if cursor is before the first record |
.Fields | Collection of fields (columns) in current record |
.RecordCount | Number of records in the recordset (may be -1 if unsupported) |
.CursorType | Cursor behavior (e.g., static, dynamic) |
.LockType | Locking behavior (read-only, optimistic, pessimistic) |
If Not rs.EOF Then Response.Write rs.Fields("Name").ValueEnd If3. Command Object Properties
| Property | Description |
|---|---|
.CommandText | SQL query or stored procedure name |
.CommandType | Type of command (text, stored proc, table direct) |
.ActiveConnection | The connection object the command runs against |
.Parameters | Collection of parameters |
Example: Check Recordset EOF Property
If rs.EOF Then Response.Write "No records found."Else Response.Write "Records found."End IfSummary
Properties provide info or control object behavior.
Access with dot notation, e.g.,
object.Property.Use them to check state, get metadata, or control actions.
Want me to show examples for specific ADO object properties or how to set some?