Click here to Skip to main content
15,894,630 members
Articles / Programming Languages / Visual Basic

Object-Oriented database design with the DatabaseObjects library

Rate me:
Please Sign up or sign in to vote.
4.00/5 (6 votes)
31 Jan 20076 min read 110.4K   3.9K   64  
Demonstrates creating object-oriented database systems with the DatabaseObjects library.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><!-- InstanceBegin template="/templates/function.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Database Objects</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="default.css" rel="stylesheet" type="text/css">
</head>

<body>
<h1>

<h1><!-- InstanceBeginEditable name="heading" -->DatabaseObjects<!-- InstanceEndEditable --></h1>
<h3><!-- InstanceBeginEditable name="subheader" --> ObjectFromFieldValues(<span class="keyword">ByVal</span>    objCollection <span class="keyword">As</span> IDatabaseObjects, 
  <span class="keyword">ByVal</span> objFieldValues <span class="keyword">As</span> SQLFieldValues)<!-- InstanceEndEditable --><br>
</h3>
</h1>

<!-- InstanceBeginEditable name="text" -->
<p>ObjectFromFieldValues returns an object using values from an SQLFieldValues
  object. This function is only really useful when attempting to load another
  object from within an <a href="IDatabaseObject_Load.htm">IDatabaseObject_Load</a> function
  which  only occurs when the <a href="IDatabaseObjects_TableJoins.htm">IDatabaseObjects_TableJoins</a> function
  has been implemented.</p>
<!-- InstanceEndEditable --><font face="Courier New, Courier, mono">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="#f6f6f6"><pre><!-- InstanceBeginEditable name="example" --><span class="comment"><font face="Courier New, Courier, mono">
'</font>Product class</span><span class="keyword">

Private Sub </span>IDatabaseObject_Load(<span class="keyword">ByVal</span> objFields <span class="keyword">As</span> <font face="Courier New, Courier, mono">DBO</font>.SQLFieldValues)<br>
    <span class="comment">'<font face="Courier New, Courier, mono">load regular fields as normal</font></span>
    pstrName = objFields(&quot;ProductName&quot;)<br>    pcurUnitPrice = objFields(&quot;UnitPrice&quot;)<br><font face="Courier New, Courier, mono">    ...</font>
<font face="Courier New, Courier, mono">
<span class="comment">    'check if a field from the adjoining table exists, if it does then we can use the associated fields</span>
    <span class="keyword">If</span> objFields.Exists(&quot;CompanyName&quot;) <span class="keyword">Then</span><br>        <span class="comment">'load the supplier object from objFields because it will contain all of the associated supplier fields</span>
<span class="comment">        'due to IDatabaseObjects_TableJoins being implemented</span><br>        <span class="keyword">Set</span> pobjSupplier = DBO.ObjectFromFieldValues(Data.Suppliers, objFields)<br><span class="keyword">    End If<br></span></font>
<span class="keyword">End Sub</span><br><span class="comment"><br></span><!-- InstanceEndEditable --></pre></td>
  </tr>
</table>
</font>

<p>&nbsp;</p>
<p align="center"><font size="1">�  Hi Integrity Systems 2005. All rights reserved.</font></p>
</body>

<!-- InstanceEnd --></html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions