Phương pháp lưu ADO
❮ Tham chiếu đối tượng tập bản ghi hoàn chỉnh
Phương thức Save lưu một đối tượng Recordset vào một tệp hoặc một đối tượng Stream. Khi phương thức lưu kết thúc, con trỏ bản ghi sẽ trỏ vào bản ghi đầu tiên của Tập bản ghi.
Lưu ý: Nếu có một bộ lọc được áp dụng cho Tập bản ghi, chỉ những bản ghi "đã lọc" mới được lưu.
Lưu ý: Phương thức này chỉ có thể được gọi trên một Recordset đang mở.
Cú pháp
objRecordset.Save destination,persistformat
Parameter | Description |
---|---|
destination | Optional. Specifies where to save the Recordset object; the path name of a file or a reference to a Stream object |
persistformat | Optional. A PersistFormatEnum value that specifies the format of the Recordset (XML or ADTG). Default is adPersistADTG |
Thí dụ
You can save a Recordset in XML format:
<%
set xmlDoc=CreateObject("Microsoft.XMLDOM")
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Customers", conn
'Save the Recordset into a DOM tree
rs.Save xmldoc, 1
%>
Giá trị PersistFormatEnum
Constant | Value | Description |
---|---|---|
adPersistADTG | 0 | Saves in a Microsoft Advanced Data TableGram (ADTG) format. |
adPersistXML | 1 | Saves in Extensible Markup Language (XML) format |
adPersistADO | 1 | Saves in ADO's own Extensible Markup Language (XML) format. This value is the same as adPersistXML and is included for backwards compatibility |
adPersistProviderSpecific | 2 | The provider will persist the Recordset using its own format |
❮ Tham chiếu đối tượng tập bản ghi hoàn chỉnh