Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Bhoopathy kalaivani
  Where is Bhoopathy kalaivani?
 Erode
 India
 Bhoopathy kalaivani
 To: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 Tags
Subject: RE: Coding problem
Thread ID: 267261 Message ID: 268590 # Views: 36 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Windows 7 and VFP
Date: Tuesday, July 13, 2010 1:29:56 PM         
   


> > Dear Experts,
> >
> > I am given the my Coding method
> >
> > This method of coding is correct or wrong any mistake in multi-user/shared mode environment.
> >
> > DataBase in Server Only
> >
> > Runing Exe in Client system
> >
> > Way is a server path stored in a exe startup.
> >
> > MyForm
> >
> >
> > My Coding is
> >
> > Form1_Load
> > USE way+'\database\table2.dbf' IN 0 ALIAS table2 SHARED
> > USE way+'\database\table3.dbf' IN 0 ALIAS table3 SHARED
> > USE way+'\database\table4.dbf' IN 0 ALIAS table4 SHARED
> > USE way+'\database\table5.dbf' IN 0 ALIAS table5 SHARED
> > USE way+'\database\table6.dbf' IN 0 ALIAS table6 SHARED
> >
> > Form1_unload
> > SELECT table2
> > USE
> > SELECT table3
> > USE
> > SELECT table4
> > USE
> > SELECT table5
> > USE
> > SELECT table6
> > USE
> >
> > All textbox result display from user enter the TextBox2 –ProposalNumber
> > TextBox2_Lastfocus
> > If !Empty(This.Value) And Thisform.command1.Caption='EDIT'
> > Select table3
> > Locate For propono=Ltrim(This.Value)
> > If Found()
> > Thisform.text2.Value=propono
> > Thisform.text3.Value=laname
> > Thisform.text4.Value=plan
> > Thisform.text5.Value=sumass
> > Thisform.text6.Value=dob
> > Thisform.text7.Value=faname
> > Thisform.text8.Value=laadd1
> > Thisform.text9.Value=laadd2
> > Thisform.text10.Value=laadd3
> > Thisform.text11.Value=ladist
> > Thisform.text12.Value=lastate
> > Thisform.text13.Value=lapinc
> > Thisform.text14.Value=laconno
> > Thisform.text15.Value=laemail
> > Thisform.text16.Value=nelaadd1
> > Thisform.text17.Value=nelaadd2
> > Thisform.text18.Value=nelaadd3
> > Thisform.text19.Value=neladist
> > Thisform.text20.Value=nelastate
> > Thisform.text21.Value=nelapinc
> > Thisform.text22.Value=proponame
> > Thisform.text23.Value=proporsp
> > Thisform.text24.Value=nomname
> > Thisform.text25.Value=nomrsp
> > Thisform.text26.Value=appname
> > Thisform.text27.Value=apprsp
> > Thisform.text2.Enabled= .F.
> > Else
> > Messagebox('RLIC Proposal No Does not Exists',16,'Warning')
> > thisform.objectclear
> > This.Value=""
> > This.SetFocus
> > Nodefault
> > Endif
> > Endif
> > If !Empty(Thisform.text2.Value) And Thisform.command1.Caption='EDIT'
> > Select table4
> > Locate For propono=Thisform.text2.Value
> > If Found()
> > Thisform.text28.Value=proponewno
> > Thisform.text29.Value=bkofcentdt
> > Else
> > Thisform.text28.Value=""
> > Thisform.text29.Value={}
> > Endif
> > Endif
> > If !Empty(Thisform.text28.Value) And Thisform.command1.Caption='EDIT'
> > Select table6
> > Locate For proponewno=Thisform.text28.Value
> > If Found()
> > Thisform.text30.Value=Contno
> > Thisform.text31.Value=Contdt
> > Thisform.text32.Value=recvdt
> > Thisform.text33.Value=despdt
> > Thisform.text34.Value=modedesp
> > Thisform.text35.Value=desppod
> > Thisform.text36.Value=desprks
> > Else
> > Thisform.text30.Value=""
> > Thisform.text31.Value={}
> > Thisform.text32.Value={}
> > Thisform.text33.Value={}
> > Thisform.text34.Value=""
> > Thisform.text35.Value=""
> > Thisform.text36.Value=""
> > Endif
> > Endif
> > If !Empty(This.Value) And Thisform.command1.Caption='SAVE'
> > Select table2
> > Locate For propono=LTRIM(Thisform.text2.Value)
> > If Found()
> > Messagebox('Proposal No Exists',16,'Warning')
> > Thisform.command3.Click
> > Endif
> > ENDIF
> >
> > Command1_click (Edit Button)
> > If This.Caption='EDIT'
> > If Empty(Thisform.Text2.Value) Or Empty(Thisform.text3.Value)
> > Messagebox('Please enter the correct Proposal No.',16,'Warning')
> > Thisform.Text2.SetFocus
> > Else
> > If Empty(Thisform.text5.Value) Or Empty(Thisform.text6.Value)
> > Messagebox('Life Assure Details are missing',16,'Warning')
> > Thisform.Text2.SetFocus
> > Else
> > Thisform.SetAll("Enabled",.T.,"Textbox")
> > Thisform.text1.Enabled= .F.
> > Thisform.text28.Enabled=Iif(Empty(Thisform.text22.Value),.F.,.T.)
> > Thisform.text29.Enabled= .F.
> > Thisform.Text30.Enabled= .F.
> > Thisform.Text31.Enabled= .F.
> > Thisform.Text32.Enabled= .F.
> > Thisform.Text33.Enabled= .F.
> > Thisform.Text34.Enabled= .F.
> > Thisform.Text35.Enabled= .F.
> > Thisform.Text36.Enabled= .F.
> > Old_propono=Thisform.Text2.Value
> > New_propono=Thisform.text28.Value
> > ChkChgName=.F.
> > ChkChgNo=.F.
> > ChkChgDet=.F.
> > ChkProNo=.F.
> > This.Caption='SAVE'
> > Thisform.command2.Enabled= .F.
> > Thisform.text3.SetFocus
> > Endif
> > Endif
> > Else
> > If Empty(Thisform.text3.Value)
> > Messagebox('Please enter the correct Proposal Name',16,'Warning')
> > Thisform.text3.SetFocus
> > Else
> > If Empty(Thisform.text4.Value) Or Empty(Thisform.text5.Value) Or Empty(Thisform.text6.Value) Or Empty(Thisform.text7.Value) Or ;
> > Empty(Thisform.text8.Value) Or Empty(Thisform.text11.Value) Or Empty(Thisform.text12.Value) Or Empty(Thisform.text13.Value) Or ;
> > Empty(Thisform.text14.Value) Or Empty(Thisform.text15.Value) Or Empty(Thisform.text16.Value) Or Empty(Thisform.text19.Value) Or ;
> > Empty(Thisform.text20.Value) Or Empty(Thisform.text21.Value) Or Empty(Thisform.text22.Value) Or Empty(Thisform.text23.Value) Or ;
> > Empty(Thisform.text24.Value) Or Empty(Thisform.text25.Value) Or Empty(Thisform.text26.Value) Or Empty(Thisform.text27.Value)
> > Messagebox('Please All Entries are Required',16,'Warning')
> > Thisform.text4.SetFocus
> > Else
> > m.laname=Ltrim(Thisform.text3.Value)
> > m.plan=Ltrim(Thisform.text4.Value)
> > m.sumass=Thisform.text5.Value
> > m.dob=Thisform.text6.Value
> > m.faname=Ltrim(Thisform.text7.Value)
> > m.laadd1=Ltrim(Thisform.text8.Value)
> > m.laadd2=Ltrim(Thisform.text9.Value)
> > m.laadd3=Ltrim(Thisform.text10.Value)
> > m.ladist=Ltrim(Thisform.text11.Value)
> > m.lastate=Ltrim(Thisform.text12.Value)
> > m.lapinc=Ltrim(Thisform.text13.Value)
> > m.laconno=Ltrim(Thisform.text14.Value)
> > m.laemail=Ltrim(Thisform.text15.Value)
> > m.nelaadd1=Ltrim(Thisform.text16.Value)
> > m.nelaadd2=Ltrim(Thisform.text17.Value)
> > m.nelaadd3=Ltrim(Thisform.text18.Value)
> > m.neladist=Ltrim(Thisform.text19.Value)
> > m.nelastate=Ltrim(Thisform.text20.Value)
> > m.nelapinc=Ltrim(Thisform.text21.Value)
> > m.proponame=Ltrim(Thisform.text22.Value)
> > m.proporsp=Thisform.text23.Value
> > m.nomname=Ltrim(Thisform.text24.Value)
> > m.nomrsp=Thisform.text25.Value
> > m.appname=Ltrim(Thisform.text26.Value)
> > m.apprsp=Thisform.text27.Value
> > If ChkChgName
> > Update table2 Set laname=m.laname Where propono==Old_propono
> > Update table3 Set laname=m.laname Where propono==Old_propono
> > Endif
> > If ChkChgName And !Empty(New_propono)
> > Update table4 Set laname=m.laname Where propono==Old_propono
> > Update table5 Set laname=m.laname Where proponewno==New_propono
> > Update table6 Set laname=m.laname Where proponewno==New_propono
> > Endif
> > If ChkChgNo And !Empty(New_propono) And !Empty(Thisform.text22.Value)
> > m.proponewno=Ltrim(Thisform.text22.Value)
> > Update table3 Set proponewno=m.proponewno Where propono==Old_propono
> > Update table4 Set proponewno=m.proponewno Where propono==Old_propono
> > Update table5 Set proponewno=m.proponewno Where proponewno==New_propono
> > Update table6 Set proponewno=m.proponewno Where proponewno==New_propono
> > Endif
> > If ChkChgDet
> > Update table3 Set plan=m.plan,sumass=m.sumass,dob=m.dob,faname=m.faname,laadd1=m.laadd1,laadd2=m.laadd2,laadd3=m.laadd3,ladist=m.ladist,lastate=m.lastate,lapinc=m.lapinc,laconno=m.laconno,laemail=m.laemail,;
> > nelaadd1=m.nelaadd1,nelaadd2=m.nelaadd2,nelaadd3=m.nelaadd3,neladist=m.neladist,nelastate=m.nelastate,nelapinc=m.nelapinc,proponame=m.proponame,proporsp=m.proporsp,nomname=m.nomname,nomrsp=m.nomrsp,appname=m.appname,apprsp=m.apprsp Where propono==Old_propono
> > Endif
> > If ChkProNo
> > m.propono=Ltrim(Thisform.Text2.Value)
> > Update table2 Set propono=m.propono Where propono==Old_propono
> > Update table3 Set propono=m.propono Where propono==Old_propono
> > Update table4 Set propono=m.propono Where propono==Old_propono
> > Endif
> > Thisform.objectclear
> > Thisform.SetAll('Enabled',.F.,'TextBox')
> > Thisform.Text2.Enabled= .T.
> > New_propono=""
> > Old_propono=""
> > ChkChgName=.F.
> > ChkChgNo=.F.
> > ChkChgDet=.F.
> > ChkProNo=.F.
> > This.Caption='EDIT'
> > Thisform.command2.Enabled= .T.
> > Thisform.Text2.SetFocus
> > Endif
> > Endif
> > Endif
> >
> >
> > My Question is
> >
> > 1. At the save time (Edit button click)
> >
> > Error:-Some tables are save some table are not save
> > File is in use – Error comes
> > How is Avoid & How is table lock & release and which time Cursersetproperty Used
> >
> > Thanking you
> >
> > Please any one help me.
> >
> > GoD is Great
> >
> > P.Bhoopathy
> > Coimbatore
>
>
>
> Create a buffered, paramterized updatable local view (or CursorAdapter object) and set all those textboxes' ControlSource property to the columns in the view. That way you don't need to invent and name some 575 variables.
> Your controls will be bound to the current row in a cursor and when the user clicks Update/Save your modifications are sent to the backend and updates the backend tables.
> -Anders


Dear Anders Altberg,

PLease Explain your words with simple example

Thanks

P.Bhoopathy.

ENTIRE THREAD

Coding problem Posted by Bhoopathy kalaivani @ 7/3/2010 2:08:39 PM
RE: Coding problem Posted by Samir H. @ 7/3/2010 3:57:04 PM
RE: Coding problem Posted by Bhoopathy kalaivani @ 7/8/2010 11:03:48 AM
RE: Coding problem Posted by Anders Altberg @ 7/8/2010 11:37:32 AM
RE: Coding problem Posted by Bhoopathy kalaivani @ 7/13/2010 1:29:56 PM