Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,102 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,681 people online right now. Registration is fast and FREE... Join Now!




Delphi Beginner

 
Reply to this topicStart new topic

Delphi Beginner

owam
26 Oct, 2007 - 08:33 AM
Post #1

New D.I.C Head
*

Joined: 26 Oct, 2007
Posts: 2


My Contributions
something like this should work but it doesnt. buf_property is the name of the table i am trying to read from and PropertyDetails is just a declaration. loSourceData and loDestData refer to units that we created at work. Now Prop_Seq_no, Property_id and Property_name are the details that i want to retrive from the table. I am actually copying from loSourceData to loDestData info stored in buf_property

Your response will be highly appreciated.


{copying buf_property }
if PropertyDetails then
begin
loSourceData := loSourcePart2.DatasetByName('buf_property');
loDestData := loDestPart2.DatasetByName('buf_property');
if assigned(loSourceData) and not loSourceData.IsEmpty then
begin
loSourceData.first;
while not loSourceData.Eof do
begin
if not (loDestData.State in [dsInsert, dsEdit]) then
loDestData.Insert;

loDestData.FieldByName('Prop_Seq_No').AsInteger := loSourceData.FieldByName('Prop_Seq_No').AsInteger;
loDestData.FieldByName('Property_Id').AsInteger := loSourceData.FieldByName('Property_Id').AsInteger;
loDestdata.FieldByName('Property_Name').AsString := loSourcedata.FieldByName('Property_Name').AsString;

loSourceData.Next;
end;
end;
end;


User is offlineProfile CardPM
+Quote Post

Levaquin
RE: Delphi Beginner
29 Nov, 2007 - 12:41 PM
Post #2

New D.I.C Head
*

Joined: 29 Nov, 2007
Posts: 1


My Contributions
QUOTE(owam @ 26 Oct, 2007 - 09:33 AM) *

something like this should work but it doesnt. buf_property is the name of the table i am trying to read from and PropertyDetails is just a declaration. loSourceData and loDestData refer to units that we created at work. Now Prop_Seq_no, Property_id and Property_name are the details that i want to retrive from the table. I am actually copying from loSourceData to loDestData info stored in buf_property

Your response will be highly appreciated.


{copying buf_property }
if PropertyDetails then
begin
loSourceData := loSourcePart2.DatasetByName('buf_property');
loDestData := loDestPart2.DatasetByName('buf_property');
if assigned(loSourceData) and not loSourceData.IsEmpty then
begin
loSourceData.first;
while not loSourceData.Eof do
begin
if not (loDestData.State in [dsInsert, dsEdit]) then
loDestData.Insert;

loDestData.FieldByName('Prop_Seq_No').AsInteger := loSourceData.FieldByName('Prop_Seq_No').AsInteger;
loDestData.FieldByName('Property_Id').AsInteger := loSourceData.FieldByName('Property_Id').AsInteger;
loDestdata.FieldByName('Property_Name').AsString := loSourcedata.FieldByName('Property_Name').AsString;

loSourceData.Next;
end;
end;
end;



try

CODE

    ...
    loDestdata.FieldByName('Property_Name').AsString  :=
    loSourcedata.FieldByName('Property_Name').AsString;
    loDestData.Post;
    loSourceData.Next;
  end;
  loDestData.ApplyUpdates;
end;
end;


This post has been edited by Levaquin: 29 Nov, 2007 - 01:29 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 08:58PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month