下面Delphi代码为何一运行,编译器就报:Incompatible types:'String'and'TDateTime'? 5
procedureTtixg_Form.DBGrid1CellClick(Column:TColumn);varsqlstr:string;riqi:TDateTime;...
procedure Ttixg_Form.DBGrid1CellClick(Column: TColumn);
var
sqlstr:string;
riqi:TDateTime;
begin
hint := column.Field.AsString;
riqi:=DateTimePicker1.DateTime;
sqlstr:='select * from t_xin where(BIRTHDAY="'+riqi+'")';
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlstr);
ADOQuery1.Open;
//BIRTHDAY字段定义为日期型 展开
var
sqlstr:string;
riqi:TDateTime;
begin
hint := column.Field.AsString;
riqi:=DateTimePicker1.DateTime;
sqlstr:='select * from t_xin where(BIRTHDAY="'+riqi+'")';
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sqlstr);
ADOQuery1.Open;
//BIRTHDAY字段定义为日期型 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询