Delphi¶àÏß³Ìѧϰ£¨9£©£º¶àÏß³ÌÊý¾Ý¿â²éѯ£¨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);
const
SQL_CONST='Select SaleDate from orders where CustNo = %d';
var
c1,c2,c3:Integer;
s1,s2,s3:string;
begin
//È¡µÃÈý¸öÑ¡Ôñ¿ò¿Í»§µÄ±àÂë
c1:=Integ
Ïà¹ØÎĵµ£º
ÈçºÎµ÷ÊÔDLL£¬ÔÚÕâÀï¾Í²»ÔÙ׸ÊöÁË£¬µ«ÊÇ£¬½ñÌì¾ÍÅöµ½ÁËÒ»¸öÌرðÆæ¹ÖµÄÎÊÌ⣬²ÎÊýÉèÖÃÕýÈ·£¬¾ÍÊDz»Äܵ÷ÊÔ£¿£¿ ͨ¹ýÉÏÍø²é×ÊÁÏ£¬·¢ÏÖÁËÎÊÌ⣬עÒ⣺
1£¬ ½«ProjectÖ÷²Ëµ¥µÄProject Options¶Ô»°¿òµÄCompilerÒ³ÃæDebuggingÑ¡ÏîÖÐµÄ Debug informaton¡¢Local symbols¡¢Assertions¸´Ñ¡¿òÑ¡ÖÐ
2£¬½«ToolsÖ÷²Ëµ¥µÄD ......
http://www.91v1.cn/bbs/read.php?tid-1797.html
ÎÒÃÇÌṩµÄÊÇÈ«Ì×,Ä¿Ç°ËûÃÇ·¢µÄ.ÉçÇøÒѼÖÆÍê±Ï.Ò»¸ùë²»ÉÙ.
-------------------------------------------------------------------------------------------------------------------------
¸Ã½Ì³ÌÓÉ91v1ÉçÇøÃâ·ÑÌṩ.¾ßÌåÃâ·ÑÁìÂëÏêÇé¹Û¿´ÖÖ×Ó°ü,
--------------- ......
2010-02-22 17:08:46
Delphi°Ñ¶àÏß³ÌÏà¹ØµÄAPI·â×°ÔÚTThreadÕâ¸öÀàÖУ¬¿ÉÒÔ·½±ãʵÏÖ¶àÏß³ÌÔËÓá£Ê×ÏÈ¿´ÏÂTThreadµÄÉùÃ÷£º
TThread = class
private
FHandle: THandle;
FThreadID: THandle;
FCreateSuspended: Boolean;
FTerminated: Boolean;
FSuspended: Boolean;
FFreeOnTerminate: ......
ÔÚʹÓöàÏ̵߳Äʱºò£¬Èç¹û¶àÏ̶߳Ôij¸öÌض¨µÄ¹«¹²Êý¾Ý»ò×ÊÔ´½øÐзÃÎÊ£¬ÐèÒª¶Ô¶àÏ߳̽øÐÐе÷²Ù×÷£¬½Ð×öÏß³Ìͬ²½¡£
ÀýÈ磺Èý¸öÏ̷ֱ߳ðÑ»·µØÏòListBoxÖÐдÈëÊý¾Ý¡£Ã»ÓнøÐÐͬ²½Ê±£¬Ð´ÈëµÄ˳ÐòÊDz»È·¶¨µÄ¡£
{Ö÷´°Ìå´úÂë}
unit Unit2;
interface
uses
Windows, Messages, SysUtils, V ......
»¥³âÁ¿ÊÇϵͳÄں˶ÔÏó£¬ËÓµÓоÍËÖ´ÐС£ËüÓëÁÙ½çÇø¹¤×÷ºÜÀàËÆ¡£²»Í¬´¦ÔÚÓÚ£º1¡¢»¥³âÁ¿¿ÉÒÔ¿ç½ø³Ì±ß½çͬ²½Ï̡߳£2¡¢¿ÉÒÔ¸ø»¥³âÁ¿È¡¸öÃû×Ö£¬Í¨¹ýÒýÓû¥³âÁ¿µÄÃû×ÖÀ´Ê¹ÓÃÒ»¸öÒÑÖªµÄ»¥³âÁ¿¶ÔÏó¡£
ʹÓû¥³âÁ¿Ö®ÀàµÄ¶ÔÏóÐèÒª·´¸´µ÷ÓÃϵͳÄںˣ¬ÆÚ¼äÐèÒª½øÐнø³ÌÉÏÏÂÎÄת»»ºÍ¿ØÖƼ¶±ðת»»£¬´ó¸ÅÐèÒªºÄ· ......