vb logo

 

Visual Basic Books
Home
Visual Basic Beginner Books
Visual Basic Database Books
Visual Basic ActiveX Books
Visual Basic Advanced Books
VB Internet Programming Books

Resources
Visual Basic Links
Add a Link
Subscribe to Mailing List

Visual Basic Books

Back Contents Next

Chapter Three Quiz

1.      What is the difference between the Dim oRS and Set oRS commands?

 

2.      What punctuation (combination of parenthesis, quotes, commas, periods, etc.) is used with the server's CreateObject method?

 

3.      What is the syntax to write on the page the data of the field named "SSN" from the record set oRS6?

 

4.      What is the syntax to use if you have a section of HTML text and want to put into the middle of it the field named "SSN" from the record set oRS6?

 

5.      I've opened a recordset using the simple method but want to print it out in reverse order. But when I use oRS.MovePrevious it fails. Why?

 

6.      Name three steps that should be performed prior to using ASP-ADO.

 

7.      In the connection parameter, how do you separate the DSN, the userID and the password?

 

8.      Write the syntax to stuff the variable named sSSN with the data in the field named "SSN" from the recordset oRS6.

 

9.      What HTML text will prevent table cells from "collapsing" when NULL data is encountered?

 

10.  If you do not have a lot of experience with HTML tables, try writing the tags and text to produce the following table. This does not require ASP-ADO, it is for practice with HTML table tags

 

1

Apples

Amelia

2

Bananas

Bob

3

Cucumber

Cathy

 

11.  Again, if you do not have a lot of experience with HTML tables, try writing the tags and text to produce the following table.

 

1

Apples

Amelia

2

 

Bob

3

Cucumber

Cathy


Chapter Three Quiz Answers

1.    Dim sets aside space in memory and reserves the word oRS as a variable name. Set assigns to this variable a reference to an object that is instantiated using the CreateObject method.

 

2.    Server.CreateObject("ADODB.recordset")
Period between Server and CreateObject
Period between ObjectType and class
ObjectType and class are inside double quotes which is within parentheses.

 

3.     

 

<%

 

Response.Write oRS6("SSN").Value

 

%>

 

 

 

4.    We recorded you with SSN <%=oRS6("SSN").Value%>.

 

5.    Recordsets opened in the simple way of this chapter are forward-only. More flexible recordsets will be discussed in a later chapter.

 

6.    Source (for example "People")
Connection (for example "DSN=Sailors")

 

7.    Set up the DSN
Familiarize yourself with the database structure
Know a valid UserID and its valid password

 

8.    With a semicolon (adding a space makes it easier to read and does not create problems)

ORS.Open "SourceTable", "DSN=MyDSNName; uid=MyUserID; pwd=MyPassword"

 

sSSN = oRS6("SSN").value

or

sSSN = oRS6("SSN")

 

9.     &nbsp;

10.   

 

<TABLE BORDER=1>

  <TR>

    <TD>1</TD>

    <TD>Apples</TD>

    <TD>Amelia</TD>

  </TR>

  <TR>

    <TD>2</TD>

    <TD>Bananas</TD>

    <TD>Bob</TD>

  </TR>

  <TR>

    <TD>3</TD>

    <TD>Cucumber</TD>

    <TD>Cathy</TD>

  </TR>

</TABLE>

 

By eliminating some spaces and carriage returns from the above we can build:

 

<TABLE BORDER=1>

<TR><TD>1</TD><TD>Apples</TD><TD>Amelia</TD></TR>

<TR><TD>2</TD><TD>Bananas</TD><TD>Bob</TD></TR>

<TR><TD>3</TD><TD>Cucumber</TD><TD>Cathy</TD></TR>

</TABLE>

 

11.

 

In this case we have to be careful not to allow the collapse of the cell which formerly held banana by retaining the <TD></TD> for the old banana cell and filling it with &nbsp;

 

<TABLE BORDER=1> 

<TR><TD>1</TD><TD>Apples</TD><TD>Amelia</TD></TR>

<TR><TD>2</TD><TD>&nbsp;</TD><TD>Bob</TD></TR>

<TR><TD>3</TD><TD>Cucumber</TD><TD>Cathy</TD></TR>

</TABLE>

 

 


End of chapter

Order from Amazon and get a 20% discount!

©1999 Wrox Press Limited, US and UK.

Email us your comments:mail
Fax: 1(916)404-7719
©1999-2000 Visual Basic Books. All rights reserved.