BA394 VBScript Lecture 7 - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

BA394 VBScript Lecture 7

Description:

BA394 VBScript Lecture 7 – PowerPoint PPT presentation

Number of Views:81
Avg rating:3.0/5.0
Slides: 16
Provided by: busine
Category:

less

Transcript and Presenter's Notes

Title: BA394 VBScript Lecture 7


1
BA394 VBScript Lecture 7
  • Tim Faltemier

2
In this Lecture
  • Finish up the SQL information that you should
    know (ADO)
  • Begin to talk about XML
  • Show A few examples and the various uses

3
ActiveX Data Objects (ADO)
  • ADO is the primary way in which you will use to
    interact with the database (SQL Statements are
    EXECUTED with ADO).
  • ADO extensions are automatically installed when
    someone installs IIS (Microsofts Web Server)
  • Note USUALLY only available on Windows machines
    NOT very versatile

4
Accessing a Database
  • In order to access a SQL database you need to do
    the following things in ADO.
  • Create an ADO connection to a database
  • Set objConn Server.CreateObject(ADODB.Connectio
    n)
  • Open the database connection
  • objConn.ConnectionString strConnect
  • objConn.Open
  • Create an ADO Recordset
  • Set rsName Server.CreateObject("ADODB.Recordset"
    )

5
Accessing a Database (II)
  • Open the Recordset
  • rsName.Open strSQL, objConn
  • Extract the data you need from the Recordset.
  • EmailAddress rsName(Email")
  • Close the Recordset
  • rsName.close
  • Set rsName nothing
  • Close the connection
  • objConn.close
  • Set objConn nothing

6
ADO Access
  • Now that you know the basic sequence of commands
    you can alter any part to give you different
    results.
  • The important things to remember are
  • You should ALWAYS close a connection after your
    finished using it. This prevents memory leaks in
    your application.
  • When accessing the data in a recordset, always
    check to see if the recordset contains any
    values, if it does not display the appropriate
    message (Otherwise error will occur).

7
ADO Access (II)
  • Although it is very easy to actually retreive
    data from a database, it is very difficult to use
    it effectively.
  • Try and use as much HTML around your data as
    possible. The more you use, the more dynamic
    your site is.
  • For example ltA hrefltrsName(WebAddress)gtgt
    ltrsName(CustomerName)gtlt/agt
  • The above will print out a dynamic web address
    and customer name in the form of a link (which
    could be useful later on)

8
Extensible Markup Language (XML)
  • A common joke that is told in XML circles (and at
    many interviews) is
  • Question When should I use XML
  • Answer When you need a buzzword in your resume.
  • XML is a markup language just like HTML
  • It is mainly used to describe data for use with
    transfers etc.

9
XML (II)
  • In HTML you have predefined tags (ltpgt, ltBRgt,
    ltHRgt, etc) in XML however you do not.
  • XML uses what you will commonly hear as a
    Document Type Definition (DTD) to describe the
    data that it passes.
  • In the next few slides, we will look deeper into
    those facts.

10
XML vs. HTML
  • XML is not a replacement for HTML as you may
    believe, as they both do totally different
    things.
  • XML was designed to describe data and to focus
    on what data is
  • HTML on the other hand was designed to display
    data and to focus directly on how the data looks

11
XML What it does
  • In short, XML does not DO anything
  • It was created as a way to structure, store, and
    send information.
  • Look at the following example message stored in
    XML on the next slide
  • You will notice that it has a clear cut
    structure, but if you were to put it in a HTML
    document nothing would happen (or at least not
    what you intended)

12
XML Message Example
  • ltMessagegt
  • lttogtJohnlt/togt
  • ltfromgtTimlt/fromgt
  • ltheadinggtLook what I can dolt/headinggt
  • ltbodygtWho would have thought I could do this with
    XML?lt/bodygt
  • lt/Messagegt
  • Notice in the message, I was free to create
    whatever tags I wanted in order to describe the
    data I was to use.

13
Final note on XML
  • Next week, I will start to show you some basic
    uses for XML and how we can begin to incorporate
    it into the projects (maybe)
  • In short XML can be a very useful and powerful
    tool in your arsenal.
  • If there is anything to be taken from this
    lecture, it is that XML is not useful in itself
    but with the use of other applications (and good
    standards) it can be very powerful.

14
Questions or Comments
15
Final Notes
  • For the next quiz, make sure you look at and
    understand all of the examples from my site and
    read the lecture notes.
  • Also make SURE you check back on the website
    before the quiz next week as there may be changes
    noted etc..
  • Finally if you have any other questions or
    problems dont hesitate to email me.
Write a Comment
User Comments (0)
About PowerShow.com