Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dear Sir, Wull U Provide the cod 2

Status
Not open for further replies.

progfox

Programmer
Jun 15, 2003
43
IN
Dear Sir,

Wull U Provide the code for adding,saving,editing the data.
Well Actually I can Do these operations using the Buttonsets from wizbuttons. But I want to do these operation in myway and also I don't want to use any dbfs in the data environment. I conclude that I want to do these operations in the manner as VB does i.e.

First Addnew
Second Save
Lastly Edit

 
Use "Mytable.dbf" in 0 Exclusive &&Open Table

Append Blank &&Add a record
Replace Mytable.myfield with "Hello" &&Edit field a value
Replace Mytable.my2field with "World"

***Let's do that another way
Insert into Mytable (myfield, my2field) Values ("Goodbye", "World") &&Add Record and edit field values same time

***As for saving changes it really depends on buffering type or lack of buffering
= TABLEUPDATE(.T.) && Save the changes


Well that is a basic answer to your question, take a look around the VFP Help File at the commands and before you know it you'll be adding, editing, and saving like a veteran.

Slighthaze = NULL
 
progfox

also I don't want to use any dbfs in the data environment.

That is an advantage VFP has over other programs, where the form opens the tables automatically for you. But if you don't want any tables in the dataenvironment you will have to open your tables by code.

First Addnew

Look at the help file on append blank

Second Save

Look at the help file on Tableupdate

Lastly Edit

Look at the help file on SetAll



This forum is meant to help you on particular problems you might be having with VFP, I would suggest you take a look at the "TasTrade" application that comes with VFP, there is many different techniques that you can learn from it.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Dear Sir ,
according to ur suggestion I have tries the following code. The methods "= CURSORSETPROP('Buffering', 5, 'podetail' )" and "=TABLEUPDATE(.T.)" are woking perfectly while updating the master dbf but while updating the child one only one record is getting updated. And also its going on hang if u place the tableupdate function after SKIP.

Also the same code is giving error in differnt for "The data Buffering Error"


SELECT pono,itemcode,itemname,size,unitofmeas,qty,ordered,rate,total from xd INTO CURSOR xpodetail WHERE flag=.T.
SELECT xpodetail
brow
SELECT podetail
GO bott
APPEND BLANK
DO WHILE !EOF()
= CURSORSETPROP('Buffering', 5, 'podetail' )
replace podetail.pono WITH xpodetail.pono
replace podetail.itemcode WITH xpodetail.itemcode
replace podetail.descriptio WITH xpodetail.itemname
replace podetail.size WITH xpodetail.size
replace podetail.unitofmeas WITH xpodetail.unitofmeas
replace podetail.required WITH xpodetail.qty
replace podetail.quantity WITH xpodetail.ordered
replace podetail.rate WITH xpodetail.rate
replace podetail.subtotal WITH xpodetail.total

SELECT xpodetail
= TABLEUPDATE(.T.)
SKIP
success="S"
ENDDO


I therefore request all of U to solve the problem. If there is any erro here then correct it or tell me any other way to get through.


Thanks & Regards

Chandan
 
My understanding is the user will select a record in the browse and then you want to go from that records they selected to the bottom of the cursor appending all of the records to the podetail table. I also am unsure why success="S' is inside of the loop structure, so I took it out, if there is a reason for it to be in there (such as success being a public variable that you reference in a stored proc in your DBC or something) then put it back inside the loop. If this is what you wanted to do then the code below should work for you. If you were trying to do something else please let us know. I have left some of your code intact because I don't wish to confuse you too much by introducing lots of new concepts, but this could have been different and better...much less code.


SELECT pono,itemcode,itemname,size,unitofmeas,qty,ordered,rate,total from xd INTO CURSOR xpodetail WHERE flag=.T.
SELECT xpodetail
browse
SELECT podetail
= CURSORSETPROP('Buffering', 5, 'podetail' )
DO WHILE !EOF("xpodetail")
append blank in "podetail"
replace podetail.pono WITH xpodetail.pono
replace podetail.itemcode WITH xpodetail.itemcode
replace podetail.descriptio WITH xpodetail.itemname
replace podetail.size WITH xpodetail.size
replace podetail.unitofmeas WITH xpodetail.unitofmeas
replace podetail.required WITH xpodetail.qty
replace podetail.quantity WITH xpodetail.ordered
replace podetail.rate WITH xpodetail.rate
replace podetail.subtotal WITH xpodetail.total
= Tableupdate(1, .F., "podetail")
SKIP in "xpodetail"
ENDDO
success="S"


Slighthaze = NULL
 
Dear Slithez,
I am honestly very thankful to U.Well U know I was Just fed up of replacing the statements form last two days.And ur suggestion took me through.

So thanks gain

Regards

Chandan

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top