Home > Back-end >  Novice to solve: increasing number automatically
Novice to solve: increasing number automatically

Time:09-16


First as the starting number, second, to increase the number of, as shown in figure how to write error, master for help!

CodePudding user response:

Links to SQL Server database

CodePudding user response:

The elder brothers you the true god, nobody answer this question

CodePudding user response:

 var SQL, S: a string; 
I, j: integer;
The begin
SQL:='basic information select file number from the old man;
DataModule1. ClientDataSet6. Active:=False;
DataModule1. ClientDataSet6. DataRequest (SQL);
DataModule1. ClientDataSet6. Active:=True;
With DataModule1. ClientDataSet6 do
The begin
While Not Eof do
The begin
S:=FieldByName (' file number). AsString;
If StrYesInt (S) then
The begin
I:=StrToInt (S);
If jend;
Next;
end;
end;
S:=Inttostr (J + 1);
While Length (S) & lt; 4 the do S:='0' + S.
DBEdit6. The DataSource. The DataSet. Edit;
DBEdit6. Text:=S;
DBEdit6. The DataSource. The DataSet. Post;
end;

To the code, change myself, getting existing number of follow-up,

CodePudding user response:

SQL SERVER with the serial number automatically incrementing,
ORACLE with field names and sequence SEQUENCE1. NEXTVAL,

CodePudding user response:

Experts write more abstruse, still see I wrote this amateur, relatively simple, ha ha:
Set the start date, forms the calendar, you simply change the line,

T:=DaysBetween (DBDateTimeEditEh1. Value, DBDateTimeEditEh2. Value);//date two days poor
Ks:=DBDateTimeEditEh1. Value;//start date

For I:=0 to t do
The begin
Rq:=incday (ks, I);

Xq:=DayOftheWeek (rq). Tostring;

If (xq='6') or (xq='7') then
Jr:='rest day'
The else
Jr:='working day';

Dm1. ADOQuery1. Close;
Dm1. ADOQuery1. SQL. The Clear;
Dm1. ADOQuery1. SQL. The Add (' date insert into table (date, week, holiday) values (: date: week: holiday) ');
Dm1. ADOQuery1. The Parameters. ParamByName (" date "). The Value:=FormatDateTime (' yyyymmdd 'rq);
Dm1. ADOQuery1. The Parameters. ParamByName (' week '). The Value:=xq;
Dm1. ADOQuery1. The Parameters. ParamByName (' holiday '). The Value:=jr.
Dm1. ADOQuery1. ExecSQL;
end;
  • Related