Function TFra_Show.IsDate(TmpDate:String):Boolean; var ADate: TDateTime; Begin Try ADate:=StrToDate(TmpDate); Result:=True; except ReSult:=False end;end;
这个我也懂了 但我不知道判断为那个列,大家看看我下面写的那里不对 {typearray是我定义的一个字符串内容为ccddmm这种类型,用来标记dbgrid中列的属性。c为字符串,d为时间,} var i:integer; day :tdatetime; begin i:=0; while i<=Length(typearray) do begin if typearray[i]='d' then begin try day:=strtodate(DBGrid1.Fields[i].value); showmessage(datetostr(day)); showmessage('dd'); except showmessage('aaaa'); exit; end; end; i:=i+1; end;
The user can select an entire row, as well as selecting individual cells. If Options includes dgRowSelect, dgEditing and dgAlwaysShowEditor are ignored.
try
StrToDate('日期');
except
showmessage('错!');
end;
try
v_date:=strtodatetime(text);
except
showmessage('error');
end
StrToDate('日期');
except
showmessage('错!');
end;
数据库应该也会自动报错,不过跳出个东西来总是不好:)
try
StrToDate('日期');
except
showmessage('错!');
end;
StrToDate('日期');
except
showmessage('错!');
end;
var
ADate: TDateTime;
Begin
Try
ADate:=StrToDate(TmpDate);
Result:=True;
except
ReSult:=False
end;end;
StrToDate('日期');
except
showmessage('错!');
end;
但我不知道判断为那个列,大家看看我下面写的那里不对
{typearray是我定义的一个字符串内容为ccddmm这种类型,用来标记dbgrid中列的属性。c为字符串,d为时间,}
var i:integer;
day :tdatetime;
begin
i:=0;
while i<=Length(typearray) do
begin
if typearray[i]='d' then
begin
try
day:=strtodate(DBGrid1.Fields[i].value);
showmessage(datetostr(day));
showmessage('dd');
except showmessage('aaaa');
exit;
end;
end;
i:=i+1;
end;
StrToDate(strDate);
except
showmessage('错!');
end;
当post时
但DBGrid1.Fields[i].value为什么为空,