Presentation is loading. Please wait.

Presentation is loading. Please wait.

ASP-12-1 Data Store Access Colorado Technical University IT420 Tim Peterson.

Similar presentations


Presentation on theme: "ASP-12-1 Data Store Access Colorado Technical University IT420 Tim Peterson."— Presentation transcript:

1 ASP-12-1 Data Store Access Colorado Technical University IT420 Tim Peterson

2 ASP-12-2 Data Store Access With ASP, we can access all sorts of data stores, not just databases. Universal Data Access (UDA) provides us the means to access all of these data stores. Using OLE-DB via ADO, dynamic web pages can be created using these data stores. ODBC restricts the user to certain types of data. OLE-DB minimizes this restriction.

3 ASP-12-3 ODBC ODBC allows us to use a common set of routines to access data stores. This means the programmer did not have to worry about where the data was stored or what type of database was being used. ODBC allows the programmer to concentrate on functionality of the application.

4 ASP-12-4 Universal Data Access If ODBC is so great, then how do we access other types of data stores, such as MS Word files, Excel, and Mail? With just database Access, this is not enough to to be called Universal Data Access (UDA). UDA has the potential to access information contained in any kind of data store.

5 ASP-12-5 OLE-DB OLE-DB is faster and easier to use than ODBC. OLE-DB may replace ODBC, eventually. OLE-DB even provides database connections through ODBC. OLE-DB introduces data providers and data consumers. ADO allows ASP pages to talk to OLE-DB.

6 ASP-12-6 ActiveX Data Objects ADO is the interface to OLE-DB. ADO is a set of objects. It sits between the application layer and the OLE-DB layer. ADO is kind of an API for OLE-DB. ADO is not strictly for ASP. It can be used by other languages such as C++, Java, etc.. ADO is a part of MDAC.

7 ASP-12-7 ADO Example Code Snippets Set objConn = Server.CreateObject(“ADODB.Connection”) strDatabaseType = “Access” objConn.Open “Provider=Microsoft.Jet.OLEDB.4.0;” & _ “DataSource=C:\students\it420\database\Nwind.mdb;” & _ “Persist Security Info=False” The screen output will come from using the Connection object which opens the Recordset object. objRS.Open “Movies”, objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable While Not objRS.EOF Response.Write objRS(“Title”) & “ ” objRS.MoveNext Wend objConn.Close Set objConn = Nothing

8 ASP-12-8 Connection Strings Connection strings consist of the following: –Provider –Driver - if using ODBC –Initial File Name or DSN. –Initial Catalog - Name of the database –User ID - Database login info –Password - Database password –Persist Security Info

9 ASP-12-9 Server Side Include Files If we wanted to connect to a database from many different ASP pages, and the database path changed, what would we have to do. SSI to the rescue. SSI’s allow you to include contents of one file within another file. This is done with the #INCLUDE command.

10 ASP-12-10 Connection Object This object is used by ADO to store information about the data store connection. A number of connection objects can connect to different data stores at the same time. Multiple connection objects can also simultaneously connect to the same data store.

11 ASP-12-11 Connection Object Dim objConn Set objConn = Server.CreateObject(“ADODB.Connection”) objConn.Open ConnectionString, UserId, Password, Options Typical connection string may look as follows (assuming SSI): objConn.ConnectionString = strConnect objConn.Open objConn.Close Set objConn = Nothing

12 ASP-12-12 Properties/Errors Collection Properties allows you to view properties of a database Properties can be used to determine the requirements of a database. Errors collection contains all errors that have been created in response to a single failure. Errors Collection only contains the most recent error. An Errors SSI file can be created for inclusion in the master ASP file.


Download ppt "ASP-12-1 Data Store Access Colorado Technical University IT420 Tim Peterson."

Similar presentations


Ads by Google