Page 308 - DCAP408_WEB_PROGRAMMING
P. 308
Web Programming
Notes
Task ADO.NET is designed around XML to work seamlessly in highly interoperable and
disconnected scenarios. Analyze what author wants to say from this statement?
Signs of an ADO Presence
More often than not, you can see signs of a supernatural ADO presence in several ADO.NET code
snippets. Want an example? Let’s consider a piece of ADO code that, although in slightly different
flavors, runs buried in the body of thousands of ASP pages and middle-tier components.
Set oCN = Server.CreateObject(“ADODB.Connection”)
oCN.Open strConn
Set oCMD = Server.CreateObject(“ADODB.Command”)
Set oCMD.ActiveConnection = oCN
Set oRS = oCMD.Execute(strCmd)
In this fragment, you explicitly create a Connection and a Command object, and when this
executes, you are returned a new Recordset object. The Connection object contains information
about the desired cursor type and location. If you choose the adOpenStatic type of cursor, and
necessarily the client-side location, you can safely close the connection and walk through the
records. Otherwise, you keep the connection open until you finish navigating through the
fetched rows.
Once you have the recordset, you scroll it using a loop as follows:
This type of code won’t work as-is in ADO.NET. However, the ADO.NET DataReader object lets
you write code that, at least functionally speaking, is nearly identical.
First off, you create a special object to govern the execution of the command. The base .NET class
is DBCommand. You normally don’t use this class; you’d use one of the more specialized .NET
classes like ADOCommand and Visual basic or any user-defined derived class. DBCommand
represents a command that the data source can understand.
While Not oRS.EOF
Response.Write(oRS(“lastname”) & “<BR>”)
oRS.MoveNext
Wend
Example: Specific VBScript EXAMPLES and code samples of MS Access visual basic
employed to perform Access form functions and operations:
How to calculate person’s age VB scripts
Set status fields of master record based on value of detail record-VBA programming
examples
Programming visual basic-compare original value to new value of field in the after update
event
Microsoft Access from field validation examples-dates,date ranges and numbers using
VBA
Send Email outlook VBA code example
Read outlook Email from Microsoft Access
302 LOVELY PROFESSIONAL UNIVERSITY