关于DELPHI多线程同步的问题 - Delphi / 非技术区
各位朋友大家好,本人刚开始研究多线程,还有很多不明白的地方,望大家指教,谢谢!
问题是这样的:
定义两个线程,当按钮连接时执行连接创建一个线程序,连接成功后执行查询按扭再创建一个线程,现在问题是查询线程
中无法利用 连接线程的SocketConnection1,如何同步呢?
部分代码如下:
定义:
type
Tthread1 = class(Tthread)
protected
procedure Execute;override;
procedure getSocketConn;
end;
type
Tthread2 = class(Tthread)
protected
procedure Execute;override;
procedure getClientDataSet;
end;
procedure Tthread1.Execute;
begin
Try
FreeOnTerminate:=true;
ConToolsFrm.SocketConnection1.ServerGUID:='{2C8E3F43-ABE4-11D4-B352-00E04C67568C}';
ConToolsFrm.SocketConnection1.ServerName:='apply_tier.Apply_data';
ConToolsFrm.SocketConnection1.Connected:=False;
ConToolsFrm.SocketConnection1.Host:= ConToolsFrm.edtHost.Text;
ConToolsFrm.SocketConnection1.Connected:=True;
ShowMessage('连接成功!');
Except
ShowMessage('连接失败,请断开后再试!');
ConToolsFrm.SocketConnection1.Connected:=False;
end;
end;
procedure Tthread2.Execute;
var
sqlStr:string;
begin
ConToolsFrm.ClientDataSet1.Close;
&nb
相关问答:
已知Python 中:
s = unicode("测试", "gb2312")
s = u'\u6d4b\u8bd5'
print s
测试
在Delphi里面如何将\u6d4b\u8bd5这样的还原成Gb2312的汉字呢?
找到个方法
......
xml := CreateOleObject('Microsoft.XMLHTTP');
xml.Open('GET','http://www.google.com', False);
xml.Send;
xml.responseText;
使用xml.responseText可以获取网页源码,但是再次 ......
delphi 數據類型 定義A~Z 為有序型,A為最小,Z最大。
Delphi(Pascal) code:
var
arr:array ['A'..'Z'] of Char;
用集合搞定
怎麼去運算呢?inc() ......
定义变量s,sql为string类型,s为函数参数,sql:='select field1 from table1 where'+s;运行时s赋值为id>7或者id<7、id=7,但是运行时总是出错,请各位帮我改错,多谢!
showMessage(sql)下看看
sql:='sel ......
数据: 年 月 日 开盘 收盘
使用下面语句搜索到了 每年每个月的月初和月末都是几号
select 年,月,MIN(日) as frist,MAX(日) AS laset from mt4his.DB GROUP BY 年,月
我想得到 每年每个月的月初和月末 ......