Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replace
Message
From
16/04/2008 07:09:34
 
 
To
16/04/2008 06:43:43
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01311003
Message ID:
01311027
Views:
19
thanks alot.



>I'm really sorry, but I don't get it. Anyway, if you want to add to your table from your cursor, you use
>Select yourtable && correct to the name of yoru table
>Append from dbf('yourcursor') && correct to the name of yoru cursor
>To change the data in the table from the cursor, you can use a Scan-Endscan loop. Inside the loop, it's safer to use a SQL Update lline than a Replace line. Something like
>Select yourcursor
>Scan
>   m.keyvalue=yourcursor.keyfield
>   Update yourtable set yourtable.field1=yourcursor.field2 where keyfield=m.keyvalue
>Endscan
>NB! Note that this is "Pseudocode" meaning that this shows how you can do it, but you must change the name of the tables, cursors, fields and variables to fill your need. Read and learn...! :-)
>
>
>>after the select i have all data at the grid i can change the values
>>at the grid all field from payroll i can use append to payroll.dbf
>>
>>i need to replace mstr.wark with tailas2.wark from the grid or cursor
>>
>>
>>thank alot.
>>
>>SELECT TAlias1.employeeid,TAlias2.nam,TAlias2.nam4,TAlias1.workdays,TAlias1.absencewp,TAlias1.absencew,TAlias1.uovertimeh,TAlias1.whovertime,TAlias1.vacations,TAlias1.sickvacati,TAlias2.wark  ;
>> FROM payroll TAlias1, mstr TAlias2 ;
>> WHERE  TAlias1.employeeid = TAlias2.no ;
>>  ORDER BY employeeid ;
>>  INTO cursor  mycur readwrite
>>
>>      thisform.Grid1.RecordSource=" mycur"
>>         thisform.Grid1.refresh()
>>
>>
>>
>>
>>>I'm sorry, I don't understand what you want to do. Please explain in more detail.
>>>
>>>>thank you
>>>>but field wark from mstr table
>>>>i need to replace mstr.wark with mycur.wark from grid1
>>>>
>>>>&& about zap i need to do that every month
>>>>
>>>>&& NB! mean what:)
>>>>
>>>>thanks for advance
>>>>
>>>>
>>>>>Your code is diffuse, so I can only guess here....
>>>>>
select payroll
>>>>>zap
>>>>>append from dbf('mycur')&& ok
>>>>>
>>>>>******************************
>>>>>***no errors no result
>>>>>SCAN
>>>>> M.EMP=payroll.employeeid && mycur must be wrong??
>>>>> M.MARK1=payroll.WARK
>>>>> Update mstr set mark=m.mark1 where no=m.emp && SQL is easier and often quicker
>>>>>ENDSCAN
>>>>><\pre>
>>>>>
>>>>>NB! Once again: you should NEVER zap a table on a regular basis, only during maintainance a few times per year. If you need to zap regularly, you must rethink your design. Usually you should use a cursor instead of a table in such cases.
>>>>>
>>>>>
>>>>>>hi all,
>>>>>>any help to active this code
>>>>>>
>>>>>>

>>>>>>select payroll
>>>>>>zap
>>>>>>append from dbf('mycur')&& ok
>>>>>>
>>>>>>******************************
>>>>>>***no errors no result
>>>>>>SCAN
>>>>>> M.EMP=mycur.employeeid
>>>>>> M.MARK1=mycur.WARK
>>>>>> replace MSTR.wark WITH M.MARK1 FOR MSTR.NO =M.EMP
>>>>>>ENDSCAN
>>>>>><\pre>
>>>>>>thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform