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 . Quote 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. . Quote 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? . Quote 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? . Quote 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? . Quote 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 . Quote 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'; . Quote 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. . Quote 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. . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.