This example uses the ActualSize and DefinedSize properties to display the defined size and actual size of a field.
<!-- BeginActualSizeJS --> <% @LANGUAGE="JScript" %> <html> <head> <title>ActualSize and DefinedSize Properties Example (JScript)</title> <style> <!-- body { font-family: 'Verdana','Arial','Helvetica',sans-serif; BACKGROUND-COLOR:white; COLOR:black; } .thead2 { background-color: #800000; font-family: 'Verdana','Arial','Helvetica',sans-serif; font-size: x-small; color: white; } .tbody { text-align: center; background-color: #f7efde; font-family: 'Verdana','Arial','Helvetica',sans-serif; font-size: x-small; } --> </style> </head> <body bgcolor="White"> <h1>ADO ActualSize and DefinedSize Properties (JScript)</h1> <% // Open the connection. var Connect = "Provider=sqloledb;Data Source=" + Request.ServerVariables("SERVER_NAME") + ";" + "Initial Catalog=Northwind;User Id=sa;Password=;" // Open a recordset on the stores table var rsSuppliers = Server.CreateObject("ADODB.Recordset.2.5"); rsSuppliers.Open("Suppliers", Connect); var strMessage; // used to build up each line before writing to document. Response.Write("<table>"); Response.Write('<tr class="thead2"><th>Field Value</th>'); Response.Write("<th>Defined Size</th>"); Response.Write("<th>Actual Size</th></tr>"); while (!rsSuppliers.EOF) { // Start a new line. strMessage = '<tr class="tbody">'; // Display the contents of the // stor_name field, the field's defined size, // and its actual size. fldCompanyName = rsSuppliers.Fields("CompanyName"); strMessage += '<td align="left">' + fldCompanyName.Value + "</td>" strMessage += "<td>" + fldCompanyName.DefinedSize + "</td>"; strMessage += "<td>" + fldCompanyName.ActualSize + "</td>"; // End the line. strMessage += "</tr>"; // Write line to document. Response.Write(strMessage); // Get next record. rsSuppliers.MoveNext; } Response.Write("</table>"); // Close table. rsSuppliers.Close(); %> </body> </html> <!-- EndActualSizeJS -->
ActualSize Property | DefinedSize Property | Field Object