delphi DBGrid显示问题
procedureTForm2.Comm1ReceiveData(Sender:TObject;Buffer:Pointer;BufferLength:Word);var...
procedure TForm2.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;
BufferLength: Word);
var str :string;
s:string;
begin
SetLength(Str,BufferLength);
move(buffer^,pchar(@Str[1])^,bufferlength);
Memo1.Text:=Memo1.Text+' '+ Str;
s:=Trim(Memo1.text);
s:=stringreplace(s,' 电压=',''' union all select ''',[rfReplaceAll]);
s:=stringreplace(s,' 电流=',''',''',[rfReplaceAll]);
s:='Insert into inputdata(电压,电流) select '''+Copy(s,6,length(s))+'''';
ADOQuery1.Close;
ADOQuery1.SQL.text:=s;
ADOQuery1.ExecSQL;
end;在运行时DBGrid中无数据 运行后关闭再打开DBGrid中又有数据了 请问我想在运行时也能在DBGrid中看到数据该怎么修改程序 展开
BufferLength: Word);
var str :string;
s:string;
begin
SetLength(Str,BufferLength);
move(buffer^,pchar(@Str[1])^,bufferlength);
Memo1.Text:=Memo1.Text+' '+ Str;
s:=Trim(Memo1.text);
s:=stringreplace(s,' 电压=',''' union all select ''',[rfReplaceAll]);
s:=stringreplace(s,' 电流=',''',''',[rfReplaceAll]);
s:='Insert into inputdata(电压,电流) select '''+Copy(s,6,length(s))+'''';
ADOQuery1.Close;
ADOQuery1.SQL.text:=s;
ADOQuery1.ExecSQL;
end;在运行时DBGrid中无数据 运行后关闭再打开DBGrid中又有数据了 请问我想在运行时也能在DBGrid中看到数据该怎么修改程序 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询