Delphi¶àÏß³Ìѧϰ£º¶àÏß³ÌÊý¾Ý¿â²éѯ£¨ADO£©
ADO¶àÏß³ÌÊý¾Ý¿â²éѯͨ³£»á³öÏÖ3¸öÎÊÌ⣺
1¡¢CoInitialize ûÓе÷ÓÃ
£¨CoInitialize was not
called£©£»ËùÒÔ£¬ÔÚʹÓÃÈκÎdbGo¶ÔÏóÇ°£¬±ØÐëÊÖ
µ÷ÓÃCoInitializeºÍCoUninitialize¡£µ÷ÓÃCoInitializeʧ°Ü»á²úÉú"CoInitialize was not
called"ÀýÍâ¡£
2¡¢»²¼²»ÔÊÐí»æ»
£¨Canvas does not allow
drawing£©£»ËùÒÔ£¬±ØÐëͨ¹ýSynchronize¹ý³ÌÀ´Í¨ÖªÖ÷Ï̷߳ÃÎÊÖ÷´°ÌåÉϵÄÈκοؼþ¡£
3¡¢²»ÄÜʹÓÃÖ÷ADOÁ¬½Ó
£¨Main TADoConnection cannot be
used!£©£»ËùÒÔ£¬Ïß³ÌÖв»ÄÜʹÓÃÖ÷Ïß³ÌÖÐTADOConnection¶ÔÏó£¬Ã¿¸öÏ̱߳ØÐë´´½¨×Ô¼ºµÄÊý¾Ý¿âÁ¬½Ó¡£
Delphi2007°²×°ºóÔÚX:\Program Files\Common Files\CodeGear
Shared\DataĿ¼ÏÂÓÐÒ»¸ödbdemos.mdbÎļþ£¬ÓÃÀ´×÷Ϊ²âÊÔµÄÀý×Ó¡£dbdemos.mdbÖеÄcustomer±í±£´æÁË¿Í»§ÐÅ
Ï¢£¬orders±íÖб£´æÁ˶©µ¥ÐÅÏ¢¡£
²âÊÔ³ÌÐòÁ÷³Ì´óÖÂÊÇÕâÑùµÄ£ºÔÚÖ÷´°ÌåÉÏ·ÅTADOConnectionºÍTQuery¿Ø¼þ£¬Æô¶¯Ê±Õâ¸öTQuery´ÓCustomer±íÖвé³ö¿Í»§±àÂë
CustNoºÍ¹«Ë¾Ãû³ÆCompany£¬·Åµ½Èý¸öCombox¿òÖУ¬·Ö±ðÔÚÈý¸öÁбí¿òÖÐÑ¡¶¨¿Í»§¹«Ë¾Ãû³Æ£¬°´ÕÕ¹«Ë¾Ãû³ÆËù¶ÔÓ¦µÄ¿Í»§´úÂ뽨Á¢Èý¸öÏß³Ìͬʱ
ÔÚorders±íÖвéѯÏúÊÛÈÕÆÚSaleDate·Ö±ðÌîÈëListBoxÖС£
{Ö÷´°Ìå´úÂë}
unit
Main;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
DB,
ADODB,
StdCtrls;
type
TForm2 =
class
(
TForm)
ComboBox1:
TComboBox;
ComboBox2:
TComboBox;
ComboBox3:
TComboBox;
ListBox1:
TListBox;
ListBox2:
TListBox;
ListBox3:
TListBox;
Button1:
TButton;
ADOConnection1:
TADOConnection;
ADOQuery1:
TADOQuery;
Label1:
TLabel;
Label2:
TLabel;
Label3:
TLabel;
procedure
FormCreate(
Sender:
TObject
)
;
procedure
Button1Click(
Sender:
TObject
)
;
private
{ Private declarations }
public
{ Public declarations }
end
;
var
Form2:
TForm2;
implementation
uses
ADOThread;
{$R *.dfm}
procedure
TForm2.
Button1Click
(
Sender:
TObject
)
Ïà¹ØÎĵµ£º
ÓÃDelphi¿ª·¢Êý¾Ý¿âÓ¦Óã¬Ò»°ã»áÉæ¼°µ½ÉÁÆÁ£¨Splash£©¡¢µÇ¼´°¿Ú¡¢Ö÷Êý¾ÝÄ£¿é£¨»òÖ÷Êý¾Ý¿âÁ¬½Ó£©ÒÔ¼°Ö÷´°¿Ú¡£Í¨³£ÔÚÏîÄ¿ÎļþÖУ¬splash´°¿ÚÏÔʾ¹ý£¬Ò»Ð©ÐèÒª¼ÓÔصÄ×ÊÔ´¡¢´°¿Ú¼ÓÔعýºó£¬Application.Run֮ǰ£¬½øÐÐÓû§µÇ¼¡£
//²âÊÔCSDN²©¿Í¶ÔDELPHI´úÂëµÄÖ§³Ö
program TEST;
uses
Forms,
Windows,
MainF in 'Ma ......
DelphiµÄ·½·¨ÀàÐÍÓУº
1.¾²Ì¬·½·¨ (Static) ĬÈÏÀàÐÍ£¬¿ÉÒÔÊ¡ÂԹؼü×Ö
2.ÐéÄâ·½·¨ (Virtual)
3.¶¯Ì¬·½·¨ (Dynamic)
4.ÏûÏ¢·½·¨ (Message)
5.³éÏó·¨·½ (Abstract)
=======================================================
1£©¾²Ì¬·½·¨[static]
¾²Ì¬·½·¨ÀàËÆÓÚͨ³£µÄ¹ý³ÌºÍº¯Êý£¬±àÒëÆ÷ÔÚ±àÒëʱ¾ÍÒÑÖ¸¶¨ÁËÊä³ö¸Ã·½· ......
Èý²ã¼Ü¹¹Ö¸µÄÊǽçÃ棬ҵÎñÂß¼ºÍÊý¾Ý´æ´¢·ÖÀë,²»ÊÇÖ¸ÎïÀíÉÏÊÇ·ñ·ÖÀë¡£
ÕâÑù×öµÄºÃ´¦ÊDzã´Î·ÖÃ÷£¬Î¬»¤ºÃ×ö£¬ÏµÍ³×ÊÔ´Ò²ºÃ·Ö²¼Ê½´¦Àí¡£
Êý¾Ý¿â²ãÄľͲ»ËµÁË£¬ÓÃMSSQL¡¢OrcaleËæÄãÁË£¬¾ÍÊÇÊý¾Ý·þÎñ²ã
ÒµÎñÂß¼µÄ»°Òª·ÖÎöÇå³þ£¬¾ÍÊÇÖмä²ã
½çÃ棬Ҳ½Ð¿Í»§¶Ë¡£ÕâÀï¾ÍÊǵõ½Êý¾ÝºÍÏÔʾÊý¾ÝµÄ²¿·ÖÁË£¬²»×öÆäËü´¦Àí¡£µ«ÊÇÊý¾ÝÓÐ ......
´ó¼ÒÔÚÈí¼þ¿ª·¢Ê±¾³£»áÓöµ½ÕâÑùµÄÇé¿ö£¬ÔÚ²»Í¬µÄ¿ª·¢»·¾³ÖÐΪʵÏÖһЩ¹¦ÄÜÏàͬµÄ¹ý³Ì£¬ÓÉÓÚ¿ª·¢ËùʹÓõÄÉè¼ÆÓïÑÔ²»Í¬£¬Òò¶ø²»µÃ²»±àдÐí¶àÀàËƵĴúÂ룬ÉõÖÁÓÐʱҪÔÚͬһ¸ö¿ª·¢»·¾³²»Í¬ÏîÄ¿ÖÐÖØд´úÂ룬Õâ¾ÍÔì³ÉÁ˺ܴóµÄ×ÊÔ´ÀË·Ñ¡£¶¯Ì¬Á´½Ó¿âÄܽϺõĽâ¾öÕâ¸öÎÊÌ⣬Öظ´ÀûÓôúÂ뽫´ó´óÌá¸ßÁË¿ª·¢Ð§ÂÊ¡£Ò»°ã£¬Óû§ÔÚÓ¦ÓóÌÐò ......