How ADO gets one of the field information for a table in a database
Source: Internet
Author: User
To obtain field information for a table in a database, the properties of the following Recordset object are known to be:
ActualSize property: The actual size of the field.
DefinedSize property: Defines the size of the field.
Type property: Field type, which is represented by the following numbers:
Text text:200
Date Time date:135
Integer int/identification code: 3
Single degree of precision: 4
Double precision: 5
Note memo:201
Whether Yes/no:17
Name property: Field name.
NumericScale property: The number of digits in the field's decimal part.
Precision Property: The maximum number of digits added to the integer and decimal digits of the field.
Example of a field information for a table in a database
Let's look at an example of using Actualsize/definedsize/type/name/numericscale/precision in ASP code.
For example, ASP code rs2.asp as follows:
<%
Set conn1 = Server.CreateObject ("ADODB. Connection ")
Conn1. Open "dbq=" & Server.MapPath ("Ntopsamp.mdb") & ";D river={microsoft Access Driver (*.mdb)};D riverid=25;fil=ms Access; "
Set rs1 = Server.CreateObject ("ADODB. Recordset ")
Rs1. Open "Products", conn1,1,3
Response.Write "Text<br>"
Response.Write "ActualSize:" & Rs1 ("name"). ActualSize & "<BR>"
Response.Write "DefinedSize:" &rs1 ("name"). DefinedSize & "<BR>"
Response.Write "Type:" & Rs1 ("name"). Type & "<BR>"
Response.Write ' Name: ' & rs1 (' name '). Name & "<BR>"
Response.Write "NumericScale:" & Rs1 ("name"). NumericScale & "<BR>"
Response.Write "Precision:" & Rs1 ("name"). Precision & "<p>"
Response.Write "Date<br>"
Response.Write "ActualSize:" & Rs1 ("date"). ActualSize & "<BR>"
Response.Write "DefinedSize:" & Rs1 ("date"). DefinedSize & "<BR>"
Response.Write "Type:" & Rs1 ("date"). Type & "<BR>"
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service