转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> VB.NET程序 >> 正文
DAO Advanced Programming         ★★★★

DAO Advanced Programming

作者:闵涛 文章来源:闵涛的学习笔记 点击数:3930 更新时间:2009/4/23 16:38:42
" & tdfTmp.Name, 1) If fProps Then Call WriteProps(tdfTmp, 2) '''' Iterate the fields collection For Each fldTmp In tdfTmp.Fields Call WriteOutput("TABLE FIELD: " & fldTmp.Name, 2) If fProps Then Call WriteProps(fldTmp, 3) Next fldTmp '''' Iterate the Indexes collection For Each idxTmp In tdfTmp.Indexes Call WriteOutput("INDEX: " & idxTmp.Name, 2) If fProps Then Call WriteProps(idxTmp, 3) '''' Iterate the index fields collection For Each fldTmp In idxTmp.Fields Call WriteOutput("INDEX FIELD: " & fldTmp.Name, 3) If fProps Then Call WriteProps(fldTmp, 4) Next fldTmp Next idxTmp Next tdfTmp '''' Iterate the Relations collection For Each relTmp In dbsCurrent.Relations Call WriteOutput("RELATION: " & relTmp.Name, 1) If fProps Then Call WriteProps(relTmp, 2) '''' Iterate the fields collection For Each fldTmp In relTmp.Fields Call WriteOutput("RELATION FIELD: " & fldTmp.Name, 2) If fProps Then Call WriteProps(fldTmp, 2) Next fldTmp Next relTmp '''' Iterate the querydefs collection For Each qdfTmp In dbsCurrent.QueryDefs Call WriteOutput("QUERY: " & qdfTmp.Name, 1) If fProps Then Call WriteProps(qdfTmp, 2) '''' Iterate the fields collection For Each fldTmp In qdfTmp.Fields Call WriteOutput("QUERY FIELD: " & fldTmp.Name, 2) If fProps Then Call WriteProps(fldTmp, 2) Next fldTmp Next qdfTmp '''' Iterate the Containers collection For Each cntTmp In dbsCurrent.Containers Call WriteOutput("CONTAINER: " & cntTmp.Name, 1) If fProps Then Call WriteProps(cntTmp, 2) '''' Iterate the Documents collection For Each docTmp In cntTmp.Documents Call WriteOutput("DOCUMENT: " & docTmp.Name, 2) If fProps Then Call WriteProps(docTmp, 3) Next docTmp Next cntTmp fDumpDAO = True Close intFileOut fDumpDAO_Exit: Exit Function fDumpDAO_Err: If fErrors Then WriteOutput "************** Error: " & Error$, 0 End If Resume Next End Function Private Sub Form_Open(Cancel As Integer) Me!lblVersion.Caption = "Version " & FMSVersion Me!txtFileName = "C:\DAO_DUMP.TXT" Me!chkProperties = True Me!chkErrors = True Me!txtTabs = 4 End Sub Private Sub WriteOutput(strOut As String, intIndent As Integer) '''' Comments : Writes the string out to the file '''' In : strOut - string to write '''' intIndent - number of indents '''' Out '''' Revisions '''' Dim strTabs As String strTabs = Space(intIndent * intTabs) Print #intFileOut, strTabs & strOut lngLines = lngLines + 1 End Sub Private Sub WriteProps(objIn As Object, intIndent As Integer) '''' Comments : Writes the name and value of the supplied property '''' In : objIn - object '''' intIndent - number of indents (hobo variable) '''' Out : '''' Revisions '''' Dim intSaveErr As Integer Dim strSaveErr As String Dim strName As String Dim varVal As Variant Dim prpTmp As Property For Each prpTmp In objIn.Properties '''' Disable error handler On Error Resume Next '''' Get the property name and value strName = prpTmp.Name varVal = prpTmp.Value intSaveErr = Err strSaveErr = Error$ '''' Reset error handler On Error GoTo 0 If intSaveErr = 0 Then Call WriteOutput(strName & ": " & varVal, intIndent) Else If fErrors Then Call WriteOutput("************** " & strName & ": Error (" & strSaveErr & ")", intIndent) End If End If Next prpTmp End Sub

Exercises for the Reader

You are welcome to extend this add-in add more functionality. For example, you may want to add the ability to write the results to a set of tables in the current database, rather than text files. Additionally, you may want to add to ability to get the structure of non-DAO objects such as forms and reports.

[Dividing Line Image]

Semi-Documented Tools and Resources

There are several Microsoft-Jet specific tools that you can use that are not fully documented in the documentation that ships with Microsoft products. Although these tools are not DAO-specific, they can make it easier to develop and maintain DAO applications.

TypeLib Browsers

Since the DAO 3.0 component includes an OLE Type Library, you can use a TypeLib browser to view all of the objects, collections, methods and properties, including stuff that is not documented. I have used the following two products with great success:

  • OLE2View, from Microsoft which ships as part of Visual C++
  • VBA Companion, from Apex Software

ISAMStats

Microsoft Jet contains an undocumented function called ISAMStats that shows various internal values. The syntax of the function is:

ISAMStats ((StatNum As Long [, Reset As Boolean]) As Long

Where StatNum is one of the following values:

StatNum Description 0 Number of disk reads 1 Number of disk writes 2 Number of reads from cache 3 Number of reads from read-ahead cache 4 Number of locks placed 5 Number of release lock calls

See the included add-in (JETMETER.EXE) for an example of how to use this function.

ShowPlan

Microsoft Jet implements a cost-based query optimize in its query engine. During the compilation process of the query, Jet determines the most effective way to execute the query. You can view this plan using the ShowPlan registry setting.

To use this setting, use the Registry Editor that comes with your operating system (REGEDIT.EXE for Windows 95 or REGEDT32.EXE for Windows NT) and add the following key to the registry:

\\HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Jet\3.0\Engines\Debug

Under this key, add a string data type entry named JETSHOWPLAN in all capital letters. To turn ShowPlan on, set the value of this new entry to "ON". To turn the feature off, set the value to "OFF". When the feature is on, a text file called SHOWPLAN.OUT is created (or appended to if it already exists) in the current directory. This file contains the query plan(s).

MSLDBUSR.DLL

You can use the 32-bit program LDBVIEW.EXE program to view the users currently logged into a database, or you can use the MSLDBUSR.DLL component for programmatic access to this information. These files and associated documentation are included with this paper.

上一页  [1] [2] [3] [4] [5] 


[常用软件]Dao ne Deepnet 三合一的浏览器 浏览器  [Web开发]DAO RDO ADO ADO.NET
[Sql Server]ASP编程入门进阶(廿一):DAO SQL之建立数据库表  
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台