Download presentation
Presentation is loading. Please wait.
Published byCoral Merritt Modified over 8 years ago
1
ASP-14-1 Advanced ASP Techniques Colorado Technical University IT420 Tim Peterson
2
ASP-14-2 Command Object ADO provides the Command object which is specifically designed to run commands against a data store. Creation of the Command object is as follows: Set objCommand = Server.CreateObject(“ADODB.Command”)
3
ASP-14-3 Command Object Execution To execute a command, we use it’s execute method: objCommand.Execute RecordsAffected, Parameters, Options RecordsAffected - This parameter is for action queries. Parameters - Holds an array of parameters passed to the command. Options - similar to the options parameter we used for the recordset object. Defines the type of command being run.
4
ASP-14-4 Parameter creation Parameter creation syntax is: Set objRS = objComm.CreateParameter(Name, Type, Direction, Size, Value) Name - Specifies the name of the parameter Type - Defines the data type of the parameter. Direction - Parameters can either be used to send or return data. Size - Specifies that maximum length of the parameter in length of char string of bytes. Value - Can be used to initialize the parameter (constant).
5
ASP-14-5 Specifying Parameter Properties Set objParam = objComm.CreateParameter objParam.Name = “Director” objParam.Type = adVarChar objParam.Size = 50 objParam.Direction = adInput objParam.Value = “Time for beer”
6
ASP-14-6 Distributed Author Versioning IIS 5.0 is referred to as WEBDAV and uses extensions of HTTP 1.1 protocol. Allows client software to manipulate server files. WEBDAV then allows for distributed authoring of documents on the Web. WEBDAV can also be used for e-mails or any other form of data store for which there is an OLE-DB provider.
7
ASP-14-7 WEBDAV Objects WEBDAV provides two additional objects that come with ADO 2.5 –Record Object - used to represent a record in a recordset. –Stream Object - represents data in either binary or plain text.
8
ASP-14-8 Semi-Structured Data NODE CHILDREN
9
ASP-14-9 Viewing Record Properties Retrieving Semi-structured Data <% Dim objNodeRecord, objNodeField Set objNodeRecord = Server.CreateObject("ADODB.Record") objNodeRecord.Open "","URL=http://my_server_name/BegASP/" Response.Write " Properties of the folder: " Response.Write " " For Each objNodeField in objNodeRecord.Fields Response.Write " " & _ " " & objNodeField.Name & " " & _ " " & objNodeField.Value & " " & _ " " Next Response.Write " " objNodeRecord.Close Set objNodeRecord = Nothing %>
10
ASP-14-10 Record Object Methods There are three methods that can be used: –CopyRecord objRecord.Open “File.txt”, “URL=http://chrisu/BegASP/” objRecord.CopyRecord “ “, “http://www.mysite.com/Examples –MoveRecord objRecord.Open “File.txt”, “URL=http://chrisu/BegASP/” objRecord.MoveRecord “ “, “http://www.mysite.com/Examples –DeleteRecord objRecord.Open “File.txt”, “URL=http://chrisu/BegASP/” objRecord.DeleteRecord
11
ASP-14-11 Stream Object This object allows us to access data contained within the Record object. To create a stream object: Set objStream = Server.CreateObject(“ADODB.Stream”) Open Method for the Stream object is as follows: objStream.Open Source, ModeofAccess, OpenOptions, UserId, Password
12
ASP-14-12 Stream Object Parameters Source - URL of the file we want to access ModeofAccess - adModeRead (read only) or adModeReadWrite (read/write access) OpenOptions - specifies where we are getting the data from –adOpenStreamFromURL - Get data from a URL source. –adOpenStreamFromRecord - Get data from an existing Record object.
13
ASP-14-13 Stream Object - Additional Methods ReadText Method: objStream.Charset = “Ascii” Response.Write (objStream.ReadText) WriteText Method: objStream.Position = 0 strText “This is the last slide. Now write in the stream” objStream.WriteText(strText)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.