解释专家: 在SQL中: update a set sfcs='有' where xm im select xm from b 在DELPHI中: Adoquery1.sql.text:='update a set sfcs=''有'' where xm in select xm from b ' where xm=''%'+Edit1.text+''''; ; 解释: 在DELPHI中,两个连续的''才输出一个',所以在sfcs=''有'' 中 当变成SQL语句时, 就可以变成 sfcs='有';后面我加了一个EDIT1的是为了更好的说明问题: xm=''%' 即可转换成xm=' 再连接EDIT1.TEXT ,最后的四个'''' 第一个与最后一个是DELPHI中的字符串的表示符,第二,三个是转换成 ' 的。 明白了吗?
对不起! unit Unit1; interface { 记住在uses部分中包括 ShellAPI} uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ShellAPI, StdCtrls; {自定义消息,当小图标捕捉到鼠标事件时Windows向回调函数发送此消息} {自定义消息,当小图标捕捉到鼠标事件时Windows向回调函数发送此消息} const MY_MESSAGE = WM_USER + 100; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormPaint(Sender: TObject); private procedure OnIconNotify(var Message: TMessage); message MY_MESSAGE; public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} {当小图标捕捉到鼠标事件时进入此过程} {当小图标捕捉到鼠标事件时进入此过程} procedure TForm1.OnIconNotify(var Message: TMessage); const Busy: Boolean = false; begin if not Busy then begin Busy := true; if Message.LParam=WM_LBUTTONDOWN then if Application.MessageBox('Are you sure', 'Exit', MB_YESNO)=IDYES then Close; Busy := false; end; end; {当主Form建立时通知Windows加入小图标} procedure TForm1.FormCreate(Sender: TObject); var nid: TNotifyIconData; begin nid.cbSize := sizeof(nid); // nid变量的字节数 nid.Wnd := Handle; // 主窗口句柄 nid.uID := -1; // 内部标识,可设为任意数 nid.hIcon := Application.Icon.Handle; // 要加入的图标句柄,可任意指? nid.hIcon := Application.Icon.Handle; // 要加入的图标句柄,可任意指?nid.szTip := 'This is a test application'; // 提示字符串 nid.uCallbackMessage := MY_MESSAGE; // 回调函数消息 nid.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE; // 指明哪些字段有?if not Shell_NotifyIcon(NIM_ADD, @nid) then begin ShowMessage('Failed!'); Application.Terminate; end; {将程序的窗口样式设为TOOL窗口,可避免在任务条上出现} SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW); end; {程序被关闭时通知Windows去掉小图标} procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); var nid: TNotifyIconData; begin nid.cbSize := sizeof(nid); // nid变量的字节数 nid.cbSize := sizeof(nid); // nid变量的字节数 nid.uID := -1; //内部标识,与加入小图标时的数一致 nid.Wnd := Handle; //主窗口句柄 Shell_NotifyIcon(NIM_DELETE, @nid); //去掉小图标 Shell_NotifyIcon(NIM_DELETE, @nid); //去掉小图标 end; {主窗口初始化完毕并显示时将激活Paint重画事件,此时将主窗口隐藏} procedure TForm1.FormPaint(Sender: TObject); begin Hide; end; end.
Tcooltrayicon
在SQL中:
update a set sfcs='有' where xm im select xm from b 在DELPHI中:
Adoquery1.sql.text:='update a set sfcs=''有'' where xm in select xm from b ' where xm=''%'+Edit1.text+'''';
;
解释: 在DELPHI中,两个连续的''才输出一个',所以在sfcs=''有'' 中 当变成SQL语句时,
就可以变成 sfcs='有';后面我加了一个EDIT1的是为了更好的说明问题:
xm=''%' 即可转换成xm=' 再连接EDIT1.TEXT ,最后的四个'''' 第一个与最后一个是DELPHI中的字符串的表示符,第二,三个是转换成 ' 的。
明白了吗?
unit Unit1; interface { 记住在uses部分中包括 ShellAPI}
uses
Windows, Messages, SysUtils, Classes,
Graphics, Controls, Forms, Dialogs,
ShellAPI, StdCtrls; {自定义消息,当小图标捕捉到鼠标事件时Windows向回调函数发送此消息}
{自定义消息,当小图标捕捉到鼠标事件时Windows向回调函数发送此消息}
const MY_MESSAGE = WM_USER + 100; type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormPaint(Sender: TObject);
private
procedure OnIconNotify(var Message: TMessage);
message MY_MESSAGE;
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.DFM}
{当小图标捕捉到鼠标事件时进入此过程}
{当小图标捕捉到鼠标事件时进入此过程}
procedure TForm1.OnIconNotify(var Message: TMessage);
const
Busy: Boolean = false;
begin
if not Busy then begin
Busy := true;
if Message.LParam=WM_LBUTTONDOWN then
if Application.MessageBox('Are you sure',
'Exit', MB_YESNO)=IDYES then Close;
Busy := false;
end;
end; {当主Form建立时通知Windows加入小图标}
procedure TForm1.FormCreate(Sender: TObject);
var
nid: TNotifyIconData;
begin
nid.cbSize := sizeof(nid); // nid变量的字节数
nid.Wnd := Handle; // 主窗口句柄
nid.uID := -1; // 内部标识,可设为任意数
nid.hIcon := Application.Icon.Handle; // 要加入的图标句柄,可任意指?
nid.hIcon := Application.Icon.Handle; // 要加入的图标句柄,可任意指?nid.szTip := 'This is a test application'; // 提示字符串
nid.uCallbackMessage := MY_MESSAGE; // 回调函数消息
nid.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE; // 指明哪些字段有?if not Shell_NotifyIcon(NIM_ADD, @nid) then begin
ShowMessage('Failed!');
Application.Terminate;
end;
{将程序的窗口样式设为TOOL窗口,可避免在任务条上出现}
SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
end; {程序被关闭时通知Windows去掉小图标}
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
nid: TNotifyIconData;
begin
nid.cbSize := sizeof(nid); // nid变量的字节数
nid.cbSize := sizeof(nid); // nid变量的字节数
nid.uID := -1; //内部标识,与加入小图标时的数一致
nid.Wnd := Handle; //主窗口句柄
Shell_NotifyIcon(NIM_DELETE, @nid); //去掉小图标
Shell_NotifyIcon(NIM_DELETE, @nid); //去掉小图标
end; {主窗口初始化完毕并显示时将激活Paint重画事件,此时将主窗口隐藏}
procedure TForm1.FormPaint(Sender: TObject);
begin
Hide;
end; end.
可以给我地址吗?
不行的话那怎么做呢?难道只能启动时弹出一个装载image控件的form吗?觉得不美观!