⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 odbc1.html

📁 win32汇编教程 希望各位多多支持
💻 HTML
字号:
<html>
<head>
<title>ODBC Programming Tutorial: Basics</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#000000" text="#FFFFFF" link="#FFFFCC" vlink="#FFCCCC" alink="#CCFFCC">
<h1 align="center"><font face="Tahoma" color="#FFFFCC">ODBC Basics</font></h1>
<p align="left"><font face="Tahoma" size="-1">This is the first tutorial in the 
  series that deals with database programming in win32asm. Database programming 
  is becoming more important in the world of IT. We cannot ignore it anymore. 
  However, there are so many types of databases in use today. If we have to learn 
  the database file formats in order to implement win32asm database programming, 
  it would take like eternity. </font></p>
<p align="left"><font face="Tahoma" size="-1">Fortunately, Microsoft has a technology 
  that helps us tremendously in this regard. It's called <b><font color="#FFFFCC">ODBC</font></b> 
  which stands for <font color="#CCFFCC"><b>Open Database Connectivity</b></font>. 
  In essence, it's a set of APIs, the same as Windows APIs, that deal specifically 
  with database programming. That is, with ODBC APIs, you have a relatively uniform 
  way of accessing a wide variety of databases.</font></p>
<p align="left"><font face="Tahoma" size="-1">How does ODBC work? What's its structure? 
  You should get a clear picture of ODBC architecture before using it. There are 
  four components in ODBC:</font></p>
<ul>
  <li><font color="#FFFFCC" face="Tahoma" size="-1"><b>Application (your program)</b></font></li>
  <li><font color="#FFFFCC" face="Tahoma" size="-1"><b>ODBC manager</b></font></li>
  <li><font color="#FFFFCC" face="Tahoma" size="-1"><b>ODBC Drivers</b></font></li>
  <li><font color="#FFFFCC" face="Tahoma" size="-1"><b>Data Sources (databases)</b></font></li>
</ul>
<p><font face="Tahoma" size="-1">The center of all four components is the <font color="#FFFFCC"><b>ODBC 
  manager</b></font>. You can think of it as your foreman. You tell him what work 
  you want done and he conveys your desire to his workers (ODBC drivers) and gets 
  the job done. If the workers have some messages for you, they tell the foreman 
  (ODBC manager) and the foreman relays the messages to you. The workers know 
  their job well thus they can get it done for you.</font></p>
<p><font face="Tahoma" size="-1">In this model, you don't talk directly with database 
  drivers. You tell ODBC manager what you want. It's the job of the ODBC manger 
  to translate your wish into reality by using the appropriate ODBC drivers. Each 
  ODBC driver knows everything there is to know about the database it's designed 
  for. Thus each component does what it does best, simplifying the jobs enormously.</font></p>
<p align="center"><font face="Tahoma" size="-1"><b><font color="#FFFFCC">Your 
  program &lt;----&gt; ODBC manager&lt;----&gt; ODBC Drivers &lt;----&gt; Databases</font></b></font></p>
<p><font face="Tahoma" size="-1">ODBC manager is supplied by Microsoft. Check 
  your Control Panel. If your machine has ODBC installed correctly, you'll find 
  <font color="#CCFFCC"><b>ODBC Data Sources (32-bit) </b></font>applet there. 
  As to ODBC drivers, Microsoft supplies several with their products. And you 
  can always obtain new ODBC drivers from the database providers. Just by installing 
  new ODBC drivers, your machine can utilize new databases it hasn't known about 
  before.</font></p>
<p><font face="Tahoma" size="-1">ODBC APIs are simple to use, however, you need 
  to know something about SQL and database such as the meaning of field, primary 
  key, record, column, row etc. I have to assume you have some basics in database 
  theory so I can get on with the mechanics of ODBC programming in win32asm. As 
  you can see, ODBC manager tries to hide the implementation details from your 
  program. That means it has to specify some standard interfaces for talking to 
  your program and the ODBC drivers. ODBC drivers differ in their capabilities 
  so there must be a way for our applications to find out whether an ODBC driver 
  supports a particular feature. ODBC defines three levels of services called 
  <font color="#FFFFCC"><b>Interface Conformance Levels</b></font>. They are Core, 
  Level 1 and Level 2. Every ODBC driver must implement all features specified 
  in the core level list where as they can choose to implement features in level 
  1 or level 2. From our applications' point of view, ODBC APIs are divided between 
  those three levels. If a specific function is labelled as core, it means you 
  can use it without checking whether it's supported by a particular ODBC driver 
  you're using. If it's a level 1 or 2 function, you need to make sure that the 
  ODBC driver supports it before using it. You can obtain the details of ODBC 
  APIs from MSDN.</font></p>
<p><font face="Tahoma" size="-1">You need to know some ODBC terms before plunging 
  into coding.</font></p>
<ul>
  <li><font color="#FFFFCC" face="Tahoma" size="-1"><b>Environment</b></font><font face="Tahoma" size="-1">. 
    It's just that, a global context in which to access data. If you are familiar 
    with DAO, you can think of it as a workspace. It contains information that 
    applies to the whole ODBC session such as the handles of connections in this 
    session. You must obtain the handle to environment before you can begin working 
    with ODBC.</font></li>
  <li><font color="#FFFFCC" face="Tahoma" size="-1"><b>Connection</b></font><font face="Tahoma" size="-1">. 
    Specify the ODBC driver and the data source (database). You can have multiple 
    connections to different databases in the same environment.</font></li>
  <li><font color="#FFFFCC" face="Tahoma" size="-1"><b>Statement</b></font><font face="Tahoma" size="-1">. 
    ODBC uses SQL as its language. Thus a statement can be simply thought of as 
    an SQL statement you want ODBC to execute.</font></li>
</ul>
<p><font face="Tahoma" size="-1">Below are the steps you usually perform when 
  coding with ODBC:</font></p>
<ol>
  <li><font face="Tahoma" size="-1">Connect to the data source</font></li>
  <li><font face="Tahoma" size="-1">Build and execute one or more SQL statements</font></li>
  <li><font face="Tahoma" size="-1">Examine the resulting records (if any)</font></li>
  <li><font face="Tahoma" size="-1">Disconnect from the data source</font></li>
</ol>
<p><font face="Tahoma" size="-1">We will learn how to perform each step in the 
  next tutorials.</font></p>
<hr>
<p align="center"><font size="-1"><b><font face="Tahoma">[<a href="http://win32asm.cjb.net">Iczelion's 
  Win32 Assembly Homepage</a>]</font></b></font></p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -