Guest Posted January 11, 2011 Share Posted January 11, 2011 Message from: "Dennis Ortiz" Hi, if i have afterinsert event attached to a Dataset and change the dataset at run time i get a runtime error. To avoid the error i need to do this : DSourceProspects.DataSet.AfterInsert := nil; DSourceProspects.Dataset := nil; unimainmodule.GetProspectsIDataset(IDataset,NewRecordID); DSourceProspects.Dataset := IDataset.HLGetDataset; DSourceProspects.DataSet.AfterInsert := ProspectAfterInsert; these is not necesary in normal delphi application or UNIGui desktop Mode . Link to comment Share on other sites More sharing options...
Guest Posted January 11, 2011 Author Share Posted January 11, 2011 Message from: "Dennis Ortiz" El 1/11/2011 1:37 PM, Dennis Ortiz escribió: > Hi, > > if i have afterinsert event attached to a Dataset and change the dataset > at run time i get a runtime error. > > To avoid the error i need to do this : > > DSourceProspects.DataSet.AfterInsert := nil; > DSourceProspects.Dataset := nil; > > unimainmodule.GetProspectsIDataset(IDataset,NewRecordID); > > DSourceProspects.Dataset := IDataset.HLGetDataset; > DSourceProspects.DataSet.AfterInsert := ProspectAfterInsert; > > these is not necesary in normal delphi application or UNIGui desktop Mode IDataset already exist in these example, GetProspectsIDataset(IDataset,NewRecordID) only close the dataset execute a new sql sentence with newRecordID and open the dataset again. . Link to comment Share on other sites More sharing options...
Guest Posted January 14, 2011 Author Share Posted January 14, 2011 Message from: "Farshad Mohajeri" "Dennis Ortiz" wrote in message news:IAyAJScsLHA.2084@anaxagvs227... > El 1/11/2011 1:37 PM, Dennis Ortiz escribió: >> Hi, >> >> if i have afterinsert event attached to a Dataset and change the dataset >> at run time i get a runtime error. >> >> To avoid the error i need to do this : >> >> DSourceProspects.DataSet.AfterInsert := nil; >> DSourceProspects.Dataset := nil; >> >> unimainmodule.GetProspectsIDataset(IDataset,NewRecordID); >> >> DSourceProspects.Dataset := IDataset.HLGetDataset; >> DSourceProspects.DataSet.AfterInsert := ProspectAfterInsert; >> >> these is not necesary in normal delphi application or UNIGui desktop Mode > > IDataset already exist in these example, > GetProspectsIDataset(IDataset,NewRecordID) only close the dataset execute > a new sql sentence with newRecordID and open the dataset again. > What visual DB Controls are attached to the Dataset? . Link to comment Share on other sites More sharing options...
Guest Posted January 14, 2011 Author Share Posted January 14, 2011 Message from: "Farshad Mohajeri" "Farshad Mohajeri" wrote in message news:IDLr%23i$sLHA.1580@anaxagvs227... > > "Dennis Ortiz" wrote in message > news:IAyAJScsLHA.2084@anaxagvs227... >> El 1/11/2011 1:37 PM, Dennis Ortiz escribió: >>> Hi, >>> >>> if i have afterinsert event attached to a Dataset and change the dataset >>> at run time i get a runtime error. >>> >>> To avoid the error i need to do this : >>> >>> DSourceProspects.DataSet.AfterInsert := nil; >>> DSourceProspects.Dataset := nil; >>> >>> unimainmodule.GetProspectsIDataset(IDataset,NewRecordID); >>> >>> DSourceProspects.Dataset := IDataset.HLGetDataset; >>> DSourceProspects.DataSet.AfterInsert := ProspectAfterInsert; >>> >>> these is not necesary in normal delphi application or UNIGui desktop >>> Mode >> >> IDataset already exist in these example, >> GetProspectsIDataset(IDataset,NewRecordID) only close the dataset execute >> a new sql sentence with newRecordID and open the dataset again. >> > > What visual DB Controls are attached to the Dataset? Besides, what code is executed in AfterInsert() event? . Link to comment Share on other sites More sharing options...
Guest Posted January 14, 2011 Author Share Posted January 14, 2011 Message from: "Farshad Mohajeri" "Dennis Ortiz" wrote in message news:IAyAJScsLHA.2084@anaxagvs227... > El 1/11/2011 1:37 PM, Dennis Ortiz escribió: >> Hi, >> >> if i have afterinsert event attached to a Dataset and change the dataset >> at run time i get a runtime error. >> >> To avoid the error i need to do this : >> >> DSourceProspects.DataSet.AfterInsert := nil; >> DSourceProspects.Dataset := nil; >> >> unimainmodule.GetProspectsIDataset(IDataset,NewRecordID); >> >> DSourceProspects.Dataset := IDataset.HLGetDataset; >> DSourceProspects.DataSet.AfterInsert := ProspectAfterInsert; >> >> these is not necesary in normal delphi application or UNIGui desktop Mode > > IDataset already exist in these example, > GetProspectsIDataset(IDataset,NewRecordID) only close the dataset execute > a new sql sentence with newRecordID and open the dataset again. > Can you give an example here? Do you change the Table in SQL statement or do you change the Query component? . Link to comment Share on other sites More sharing options...
Guest Posted January 15, 2011 Author Share Posted January 15, 2011 Message from: "Dennis Ortiz" >>> if i have afterinsert event attached to a Dataset and change the dataset >>> at run time i get a runtime error. >>> >>> To avoid the error i need to do this : >>> >>> DSourceProspects.DataSet.AfterInsert := nil; >>> DSourceProspects.Dataset := nil; >>> >>> unimainmodule.GetProspectsIDataset(IDataset,NewRecordID); >>> >>> DSourceProspects.Dataset := IDataset.HLGetDataset; >>> DSourceProspects.DataSet.AfterInsert := ProspectAfterInsert; >>> >>> these is not necesary in normal delphi application or UNIGui desktop Mode >> >> IDataset already exist in these example, >> GetProspectsIDataset(IDataset,NewRecordID) only close the dataset execute >> a new sql sentence with newRecordID and open the dataset again. >> > > What visual DB Controls are attached to the Dataset? TUniEdit and TuniDBlookupCombo, I will test with UnidbGrid and let you know . Link to comment Share on other sites More sharing options...
Guest Posted January 15, 2011 Author Share Posted January 15, 2011 Message from: "Dennis Ortiz" El 1/14/2011 10:41 AM, Farshad Mohajeri escribió: > "Farshad Mohajeri" wrote in message > news:IDLr%23i$sLHA.1580@anaxagvs227... >> >> "Dennis Ortiz" wrote in message >> news:IAyAJScsLHA.2084@anaxagvs227... >>> El 1/11/2011 1:37 PM, Dennis Ortiz escribió: >>>> Hi, >>>> >>>> if i have afterinsert event attached to a Dataset and change the dataset >>>> at run time i get a runtime error. >>>> >>>> To avoid the error i need to do this : >>>> >>>> DSourceProspects.DataSet.AfterInsert := nil; >>>> DSourceProspects.Dataset := nil; >>>> >>>> unimainmodule.GetProspectsIDataset(IDataset,NewRecordID); >>>> >>>> DSourceProspects.Dataset := IDataset.HLGetDataset; >>>> DSourceProspects.DataSet.AfterInsert := ProspectAfterInsert; >>>> >>>> these is not necesary in normal delphi application or UNIGui desktop >>>> Mode >>> >>> IDataset already exist in these example, >>> GetProspectsIDataset(IDataset,NewRecordID) only close the dataset execute >>> a new sql sentence with newRecordID and open the dataset again. >>> >> >> What visual DB Controls are attached to the Dataset? > > > Besides, what code is executed in AfterInsert() event? i test the problem with the following code: IDataset.hlFieldByName('RecordDate').AsDatetime := Date; IDataset.hlFieldByName('State').AsString := 'PR'; . Link to comment Share on other sites More sharing options...
Guest Posted January 15, 2011 Author Share Posted January 15, 2011 Message from: "Dennis Ortiz" El 1/14/2011 10:49 AM, Farshad Mohajeri escribió: > "Dennis Ortiz" wrote in message > news:IAyAJScsLHA.2084@anaxagvs227... >> El 1/11/2011 1:37 PM, Dennis Ortiz escribió: >>> Hi, >>> >>> if i have afterinsert event attached to a Dataset and change the dataset >>> at run time i get a runtime error. >>> >>> To avoid the error i need to do this : >>> >>> DSourceProspects.DataSet.AfterInsert := nil; >>> DSourceProspects.Dataset := nil; >>> >>> unimainmodule.GetProspectsIDataset(IDataset,NewRecordID); >>> >>> DSourceProspects.Dataset := IDataset.HLGetDataset; >>> DSourceProspects.DataSet.AfterInsert := ProspectAfterInsert; >>> >>> these is not necesary in normal delphi application or UNIGui desktop Mode >> >> IDataset already exist in these example, >> GetProspectsIDataset(IDataset,NewRecordID) only close the dataset execute >> a new sql sentence with newRecordID and open the dataset again. >> > > Can you give an example here? Do you change the Table in SQL statement or do > you change the Query component? The query component is the same, i create once and reuse it closing the dataset change de sql property and open again. . Link to comment Share on other sites More sharing options...
Guest Posted January 17, 2011 Author Share Posted January 17, 2011 Message from: "Farshad Mohajeri" "Dennis Ortiz" wrote in message news:dw3AKxDtLHA.1580@anaxagvs227... >>>> if i have afterinsert event attached to a Dataset and change the >>>> dataset >>>> at run time i get a runtime error. >>>> >>>> To avoid the error i need to do this : >>>> >>>> DSourceProspects.DataSet.AfterInsert := nil; >>>> DSourceProspects.Dataset := nil; >>>> >>>> unimainmodule.GetProspectsIDataset(IDataset,NewRecordID); >>>> >>>> DSourceProspects.Dataset := IDataset.HLGetDataset; >>>> DSourceProspects.DataSet.AfterInsert := ProspectAfterInsert; >>>> >>>> these is not necesary in normal delphi application or UNIGui desktop >>>> Mode >>> >>> IDataset already exist in these example, >>> GetProspectsIDataset(IDataset,NewRecordID) only close the dataset >>> execute >>> a new sql sentence with newRecordID and open the dataset again. >>> >> >> What visual DB Controls are attached to the Dataset? > > TUniEdit and TuniDBlookupCombo, I will test with UnidbGrid and let you > know If you can provide a complete test case that will be great. . Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now