

taariq
Members-
Content Count
21 -
Joined
-
Last visited
Community Reputation
0 NeutralRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
It is finally working... Thank you so much I am definitely going to redo it now and learn learn.... Thank you so much for your time....
-
Good day Thank you - getting closer now.... I updated the code to include amountex - hope I did it correct - it runs and then I get this error... My current records The updated code procedure TMainForm.Button1Click(Sender: TObject); //declare var to enter new job card var sOrderNo, sJobName , sStartDate, sCompletionDate, sAmountEx: string ; begin sOrderNo := Inputbox ( 'OrderNo' , 'Enter OrderNo' , 'QU000' ) ; sJobName := Inputbox ( 'JobName' , 'Enter JobName' , 'Company Name' ) ; sStartDate := Inputbox ( 'StartDate' , 'Enter Start Date' , 'YYYY/MM/DD' ) ; sCompletionDate := Inputbox ( 'CompletionDate' , 'Enter Completion Date' , 'YYYY/MM/DD' ) ; sAmountEx := Inputbox ( 'AmountEx' , 'Enter Amount Ex' , 'R ' ) ; dmTas.tblJobCard.Connection.ExecSQL('INSERT INTO jobCard (orderno,jobname,StartDate,Completiondate,AmountEx) values (?,?,?,?,?)', [sOrderNo,sJobName,sStartDate,sCompletionDate,sAmountEx]); // // if you want to retrieve last id you can use ExecSQLScalar //LID:=dmTas.tblJobCard.Connection.ExeSQL('INSERT INTO jobCard (orderno,jobname,StartDate,Completiondate,AmountEx) values (?,?,?,?,?) RETRUNING ID into :id', [sOrderNo,sJobName,sStartDate,sCompletionDate,sAmountEx]); // put LID as private or public of the form // do refresh Grid end;
-
Good day I get runtime error? Sure I did something wrong - I did check my typing
-
Good day I did create Generator BUT for some reason Only works in Flamerobin and not in Delphi...
-
Good day Thank you so much I will have a look - this is my first FlameRobin and Firecad database - I had it all working 100% with a Access database... So now just trying to understand Flamerobin and Firecad ...... But for now if I want to take the ID as I got it in DBText2 and + 1 their how will I set the following to get the value from a label or the dbtext iID:= StrToInt ( Inputbox ( 'ID' , 'ID' , '002' ) ) ;
-
That is the issue I got ? In Flamerobin I can add a record and it generates the id for the next record... But in Delphi it asks for ID? My code that I currently got where it asks for id... I get error > Field 'ID' must have a value. procedure TMainForm.Button1Click(Sender: TObject); //declare my var to enter new job card var sOrderNo, sJobName , sStartDate, sCompletionDate, sAmountEx: string ; //iID : integer; begin //asign values to input box //iID:= StrToInt ( Inputbox ( 'ID' , 'ID' , '002' ) ) ; sOrderNo := Inputbox ( 'OrderNo' , 'Enter OrderNo' , 'QU000' ) ; sJobName := Inputbox ( 'JobName' , 'Enter JobName' , 'Company Name' ) ; sStartDate := Inputbox ( 'StartDate' , 'Enter Start Date' , 'YYYY/MM/DD' ) ; sCompletionDate := Inputbox ( 'CompletionDate' , 'Enter Completion Date' , 'YYYY/MM/DD' ) ; sAmountEx := Inputbox ( 'AmountEx' , 'Enter Amount Ex' , 'R ' ) ; //insert values to DBgrid dmTaS.tblJobCard.Insert ; //dmTaS.tblJobCard['ID' ] := iID ; dmTaS.tblJobCard['OrderNo' ] := sOrderNo ; dmTaS.tblJobCard['JobName' ] := sJobName ; dmTaS.tblJobCard['StartDate' ] := sStartDate ; dmTaS.tblJobCard['CompletionDate' ] := sCompletionDate ; dmTaS.tblJobCard['AmountEx' ] := sAmountEx ; dmTaS.tblJobCard.Post ; //refresh db grid DBGrid1.DataSource.DataSet.Refresh; //show mesagges end; But if I do it like the following and add the ID manually it works - so I sorted the query via sql to get the last ID - I have the last ID in DBText2 - so now trying to figure out how to + 1 and give the value to iID procedure TMainForm.Button1Click(Sender: TObject); //declare my var to enter new job card var sOrderNo, sJobName , sStartDate, sCompletionDate, sAmountEx: string ; iID : integer; begin //asign values to input box iID:= StrToInt ( Inputbox ( 'ID' , 'ID' , '002' ) ) ; sOrderNo := Inputbox ( 'OrderNo' , 'Enter OrderNo' , 'QU000' ) ; sJobName := Inputbox ( 'JobName' , 'Enter JobName' , 'Company Name' ) ; sStartDate := Inputbox ( 'StartDate' , 'Enter Start Date' , 'YYYY/MM/DD' ) ; sCompletionDate := Inputbox ( 'CompletionDate' , 'Enter Completion Date' , 'YYYY/MM/DD' ) ; sAmountEx := Inputbox ( 'AmountEx' , 'Enter Amount Ex' , 'R ' ) ; //insert values to DBgrid dmTaS.tblJobCard.Insert ; dmTaS.tblJobCard['ID' ] := iID ; dmTaS.tblJobCard['OrderNo' ] := sOrderNo ; dmTaS.tblJobCard['JobName' ] := sJobName ; dmTaS.tblJobCard['StartDate' ] := sStartDate ; dmTaS.tblJobCard['CompletionDate' ] := sCompletionDate ; dmTaS.tblJobCard['AmountEx' ] := sAmountEx ; dmTaS.tblJobCard.Post ; //refresh db grid DBGrid1.DataSource.DataSet.Refresh; //show mesagges end;
-
can you give me a code example and where will I use it - sorry dont understand 100%
-
Good day Yes sorry I used FDQuery to sort table... Sorry still learning...
-
Good day I am VCL I got my table ordered correctly now via SQL It is ordering DESC I got the last ID now in a DBText2 So all I have to figure out now is how to add +1 to the value and I assume update the following... iID:= StrToInt ( Inputbox ( 'ID' , 'ID' , '002' ) ) ; or dmTaS.tblJobCard['ID' ] := iID ; So the Delphi passes the next id on .... I think...
-
Good day I got it to work now from Delphi side when I manual add the id... Now I see that the sort by does not work and I have to do it by SQL.. So now I am trying to figure out how to sort the db grid to get last ID record to get the next ID - is this correct ? please point me in the right direction.... Thank you
-
Good day I got Flamerobin now to auto generate the id when I insert new record via Flamerobin But on my Delphi side it is still asking for valid ID? Sorry for all the question, but learning....
-
thanks for the quick reply - I don't understand that - sorry newbie - first time working with Firebird and flamerobin... Maybe I created the table wrong - here is the code I used to created the table.. create table JobCard (id integer generated by default as identity primary key, orderno varchar(12), jobname varchar(100), startdate varchar(24), completiondate varchar(24), amountex varchar(12), desc varchar (50) );
-
Good day I tried that already id Flamerobin and get the following error... Please view attached image
-
Thank for all the help - really learning a lot now - thank you so much for your time and effort... So now I did the following... 1. Create my Firbird databse 2. Used FlameRobin 3. I added a record via Delphi to the database - so happy 4. Now I am trying to generate the ID next number so I don't have to manually add it... My code works all fine adding record, but not once I add the code to sort field to get ID vale... I get error under //get next ID procedure TMainForm.Button1Click(Sender: TObject); //declare my var to enter new job card var sOrderNo, sJobName , sStartDate, sCompletionDate, sAmountEx: string ; iID : integer; begin //assign values to input box //iID:= StrToInt ( Inputbox ( 'ID' , 'ID' , '002' ) ) ; sOrderNo := Inputbox ( 'OrderNo' , 'Enter OrderNo' , 'QU000' ) ; sJobName := Inputbox ( 'JobName' , 'Enter JobName' , 'Company Name' ) ; sStartDate := Inputbox ( 'StartDate' , 'Enter Start Date' , 'YYYY/MM/DD' ) ; sCompletionDate := Inputbox ( 'CompletionDate' , 'Enter Completion Date' , 'YYYY/MM/DD' ) ; sAmountEx := Inputbox ( 'AmountEx' , 'Enter Amount Ex' , 'R ' ) ; //get next ID dmTaS.tblJobCard.Sort := 'ID ASC' ; dmTaS.tblJobCard.Last; iID : = dmTaS.tblJobCard['ID'] + 1 ; //insert values to DBgrid dmTaS.tblJobCard.Insert ; dmTaS.tblJobCard['ID' ] := iID ; dmTaS.tblJobCard['OrderNo' ] := sOrderNo ; dmTaS.tblJobCard['JobName' ] := sJobName ; dmTaS.tblJobCard['StartDate' ] := sStartDate ; dmTaS.tblJobCard['CompletionDate' ] := sCompletionDate ; dmTaS.tblJobCard['AmountEx' ] := sAmountEx ; dmTaS.tblJobCard.Post ; //refresh db grid DBGrid1.DataSource.DataSet.Refresh; //show messages Thank you