procedure TfrmServerMain.write_Score; var ScoreRec:Up_Score_Info; DataFile:File of Up_Score_Info; Count:Integer; begin AssignFile(DataFile,SD_SaveScore.FileName); ReWrite(DataFile); ADOQuery1.First; count:=1; try while not ADOQuery1.Eof do begin
begin AssignFile(DataFile,SD_SaveScore.FileName); ReWrite(DataFile); Append(DataFile);//這一句少了
begin AssignFile(DataFile,SD_SaveScore.FileName); ReWrite(DataFile); Append(DataFile);//少了這一句
I/O runtime errors always cause an exception.Number Name Description 100 Disk read error Reported by Read on a typed file if you attempt to read past the end of the file. 101 Disk write error Reported by CloseFile, Write, WriteIn, or Flush if the disk becomes full. 102 File not assigned Reported by Reset, Rewrite, Append, Rename, or Erase if the file variable has not been assigned a name through a call to Assign or AssignFile. 103 File not open Reported by CloseFile, Read Write, Seek, Eof, FilePos, FileSize, Flush, BlockRead, or BlockWrite if the file is not open. 104 File not open for input Reported by Read, Readln, Eof, Eoln, SeekEof, or SeekEoln on a text file if the file is not open for input. 105 File not open for output Reported by Write or Writeln on a text file if you do not generate a Console application. 106 Invalid numeric format Reported by Read or Readln if a numeric value read from a text file does not conform to the proper numeric format.
var
ScoreRec:Up_Score_Info;
DataFile:File of Up_Score_Info;
Count:Integer;
begin
AssignFile(DataFile,SD_SaveScore.FileName);
ReWrite(DataFile);
ADOQuery1.First;
count:=1;
try
while not ADOQuery1.Eof do
begin
ScoreRec.Zkzh:=ADOQuery1.FieldByName('EXID').AsString; //准考证号
ScoreRec.Xm:=ADOQuery1.FieldByName('STNA').AsString; // 考生姓名
ScoreRec.KsId:=ADOQuery1.FieldByName('STID').AsString; // 身份证号
ScoreRec.Dengji:=ADOQuery1.FieldByName('LEVE').AsString;
ScoreRec.Banji:=ADOQuery1.FieldByName('CLAS').AsString;
ScoreRec.Chengji:=ADOQuery1.FieldByName('SCOR').AsString;
write(DataFile,ScoreRec);
ADOQuery1.Next;
Count:=Count+1;
end;
finally
CloseFile(DataFile);
end;
end;请问哪儿有问题,程序是从SQL Server导出成绩用.dat 文件保存下来
AssignFile(DataFile,SD_SaveScore.FileName);
ReWrite(DataFile);
Append(DataFile);//這一句少了
AssignFile(DataFile,SD_SaveScore.FileName);
ReWrite(DataFile);
Append(DataFile);//少了這一句
100 Disk read error Reported by Read on a typed file if you attempt to read past the end of the file.
101 Disk write error Reported by CloseFile, Write, WriteIn, or Flush if the disk becomes full.
102 File not assigned Reported by Reset, Rewrite, Append, Rename, or Erase if the file variable has not been assigned a name through a call to Assign or AssignFile.
103 File not open Reported by CloseFile, Read Write, Seek, Eof, FilePos, FileSize, Flush, BlockRead, or BlockWrite if the file is not open.
104 File not open for input Reported by Read, Readln, Eof, Eoln, SeekEof, or SeekEoln on a text file if the file is not open for input.
105 File not open for output Reported by Write or Writeln on a text file if you do not generate a Console application.
106 Invalid numeric format Reported by Read or Readln if a numeric value read from a text file does not conform to the proper numeric format.