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

📄 vcgxb.htm

📁 Visual C++与数据库的连接经典实例
💻 HTM
📖 第 1 页 / 共 2 页
字号:
cx, cy

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

short (used as x or y length; the c stands for &quot;count&quot;)

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

dw

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

DWORD (unsigned long)

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

fn

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Function (not used often)

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

h

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Handle (generic)

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

i

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

int

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

l

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

LONG (long)

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

n

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

short or int

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

p

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

Pointer

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

s

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

String

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

sz

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

A string terminated by the 0 byte

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

w

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

UINT (unsigned int) or WORD (unsigned word)

</FONT>

<TR>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

x, y

</FONT>

<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>

short (used as an x-coordinate or y-coordinate)</FONT>

</TABLE></CENTER><BR>

<A NAME="E68E144"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>Formatting Your C/C++ Source Code</B></FONT></CENTER></H3>

<BR>

<P>When writing C or C++ code, you should try to make your source as attractive as possible.

<BR>

<UL>

<LI>Don't comment the obvious. The comment in the following statement is meaningless, because the statement's action is clear without it:

<BR>

<BR>

</UL>

<UL>

<UL>

<BR>

<PRE>

<FONT COLOR="#000080">++i;  // Increment i</FONT></PRE></UL></UL>

<UL>

<LI>Align your code so that opening and closing French braces are in the same column and on lines by themselves. Don't place an opening brace at the end of a statement that begins a block. The following example shows how you can easily see the beginning of the block, even if the indentation isn't always correct. When braces are on lines by themselves (with comments, if necessary), they're easier to see:

<BR>

<BR>

</UL>

<UL>

<UL>

<PRE>

<FONT COLOR="#000080">    for (i = 0; i &lt; 5; I++)

    {// Document the loop's purpose!

        j = nIndexArray[i];

//      Other statements....

    }</FONT></PRE></UL></UL>

<UL>

<LI>Place variable declarations at the beginning of a module whenever possible. Don't put more than one declaration on a line, and always initialize variables:

<BR>

<BR>

</UL>

<UL>

<UL>

<PRE>

<FONT COLOR="#000080">#define ARRAY_SIZE   5

double function(double * dParameter)

{

double   dOurTotal[ARRAY_SIZE] = {0.0, 0.0, 0.0, 0.0, 0.0};

double   dTotal = 0.0;

double   dAverage = 0.0;

int      i = 0;

int      nIndex = 0;

WORD     wWord = 0;

char *   pString = NULL;

HANDLE   hHandle = NULL;

// Indent all source lines after declarations by one tab stop

    for (i = 0; i &lt; ARRAY_SIZE; I++)

    {

        dTotal += dParameter[i];

    }

    dAverage = dTotal / ARRAY_SIZE;

    return (dAverage);

}</FONT></PRE></UL></UL>

<UL>

<LI>Use spaces logically. Separate symbols (such as =, +, -, *, and /), constants, variable names, and keywords with both leading and trailing spaces:

<BR>

<BR>

</UL>

<UL>

<UL>

<PRE>

<FONT COLOR="#000080">// Hard to read:

    i=(j/25)+45/2*8;

// Easier to read:

    i = (j / 25) + 45 / 2 * 8;</FONT></PRE></UL></UL>

<UL>

<LI>When in doubt (for many programmers, this is most of the time), use parentheses in expressions. The following examples show how hard it can be to quickly see the order of expression execution when there are no parentheses:

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">// Hard to read and understand:

    i = j / 25 + 45 / k * 8;

// Easy to read and understand:

    i = ((j / 25) + (45 / k)) * 8;</FONT></PRE>

<BR>Notice in the second example that the programmer didn't want the default order of execution!

<BR>

<BR>

<LI>Format your code logically. Don't have more than one executable statement per line of source code. Doing this makes it difficult to follow the flow of the program and impossible to set a breakpoint somewhere other than at the first executable statement on the source line.

<BR>

<BR>

<LI>Indent, indent, indent. Never skip indentations. Whenever you do, you will usually induce a program logic error (this is Murphy's Law).

<BR>

<BR>

</UL><P ALIGN=CENTER>

<A HREF="vcgxa.htm" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/vcgxa.htm" TARGET="_self"><IMG SRC="blanprev.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/blanprev.gif" WIDTH = 37 HEIGHT = 37 BORDER = 0 ALT="Previous Page"></A>

<A HREF="#I0" TARGET="_self"><IMG SRC="blantop.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/blantop.gif" WIDTH = 37 HEIGHT = 37 BORDER = 0 ALT="Page Top"></A>

<A HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/index.htm" TARGET="_self"><IMG SRC="blantoc.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/blantoc.gif" WIDTH = 37 HEIGHT = 37 BORDER = 0 ALT="TOC"></A>

<A HREF="vcgxc.htm" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/vcgxc.htm" TARGET="_self"><IMG SRC="blannext.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/blannext.gif" WIDTH = 37 HEIGHT = 37 BORDER = 0 ALT="Next Page"></A>


</BODY></HTML>

⌨️ 快捷键说明

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