How Do I copy one field value to a string variable 
Author Message
 How Do I copy one field value to a string variable

Hi I am new to Delphi5 programming and need some help. What I want to
do is copy the contents of one column from a table to a string
variable. The column value will be in the format of:-
'store:101570:1:101570.eps' I then need to extract only the value
101570 and copy that value to two different columns in two tables.

Any help would be brilliant.



Tue, 21 Sep 2004 18:09:37 GMT  
 How Do I copy one field value to a string variable
: Hi I am new to Delphi5 programming and need some help. What I want to
: do is copy the contents of one column from a table to a string
: variable. The column value will be in the format of:-
: 'store:101570:1:101570.eps' I then need to extract only the value
: 101570 and copy that value to two different columns in two tables.

: Any help would be brilliant.

To assign the entire field value to a string:
  myString := Table1.FieldByName('FIELDNAME').AsString;

If you will always start with the seventh character and
end after six more characters, simply use the copy()
function to copy the relevant data to another string.
If the data width varies, use the Pos() function to search
for the position of the first and second colons.
--
Rick Carter

Chair,   Paradox/Delphi SIG,   Cincinnati PC Users Group



Tue, 21 Sep 2004 19:52:09 GMT  
 How Do I copy one field value to a string variable

Quote:


> : Hi I am new to Delphi5 programming and need some help. What I want to
> : do is copy the contents of one column from a table to a string
> : variable. The column value will be in the format of:-
> : 'store:101570:1:101570.eps' I then need to extract only the value
> : 101570 and copy that value to two different columns in two tables.

> : Any help would be brilliant.

> To assign the entire field value to a string:
>   myString := Table1.FieldByName('FIELDNAME').AsString;

> If you will always start with the seventh character and
> end after six more characters, simply use the copy()
> function to copy the relevant data to another string.
> If the data width varies, use the Pos() function to search
> for the position of the first and second colons.

Thanks for that info Richard I will try it out and let you know

Regards

Bev



Wed, 22 Sep 2004 00:06:57 GMT  
 How Do I copy one field value to a string variable

Quote:

> Hi I am new to Delphi5 programming and need some help. What I want to
> do is copy the contents of one column from a table to a string
> variable. The column value will be in the format of:-
> 'store:101570:1:101570.eps' I then need to extract only the value
> 101570 and copy that value to two different columns in two tables.

> Any help would be brilliant.

Thanks Richard but I forgot to mention there could be 100's of rows
that I need to extract that value from so should I be using a
TStringlist.


Wed, 22 Sep 2004 00:11:16 GMT  
 How Do I copy one field value to a string variable
You don't need a string list. Just transfer them one by one.
Cheers,
JB


Fri, 24 Sep 2004 13:13:12 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Help: copy memo field from one table to another field

2. Copy data from string field to memo field

3. Copy all field values

4. DataBaseModule and Missing Values in Field which is required one

5. Passing string from DBF field to a variable (Halcyon 4.0)

6. How to copy field's value from one record to a new record ?

7. Doing a search in a one to many database

8. Default Values through Sequences, How is it done?

9. Get error when affect a String Field in a string var

10. copying data from one table to another

11. Change one field when another field changes?

12. Copying records from one table to another?

 

 
Powered by phpBB® Forum Software