RE: Uptating from a local view
- From: Don <Don@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 14 Nov 2005 00:52:13 -0800
Many thanks Mark, it worked.
"Mark" wrote:
> Hi Don,
> I think I was a bit short with my explications. Sorry.
> The trick is to create the view in the View Designer, save and close the
> database, run the GENDBC.PRG (provided with VFP), look for the code lines
> dealing with the view, copy/paste it into your procedure and make the desired
> modifications. Et voilà!
> hth
> Mark
>
> "Don" wrote:
>
> > Sorry, Mark there was a typing mistake in my code. In fact, I have specified
> > a key field. The code should look like below.
> >
> > OPEN DATABASE data1
> >
> > CREATE SQL VIEW MonFile AS SELECT ps_dep, ps_no, py_nhrs ;
> > FROM data1!oct05 ;
> > WHERE ps_no = ( ?mEmp )
> >
> > DBSetProp('MonFile',"View","SendUpdates",.T.)
> > DBSetProp('MonFile',"View","BatchUpdateCount",1)
> > DBSetProp('MonFile',"View","CompareMemo",.T.)
> > DBSetProp('MonFile',"View","FetchAsNeeded",.F.)
> > DBSetProp('MonFile',"View","FetchMemo",.T.)
> > DBSetProp('MonFile',"View","FetchSize",100)
> > DBSetProp('MonFile',"View","MaxRecords",-1)
> > DBSetProp('MonFile',"View","Prepared",.F.)
> > DBSetProp('MonFile',"View","UpdateType",1)
> > DBSetProp('MonFile',"View","UseMemoSize",255)
> > DBSetProp('MonFile',"View","Tables","Data1!oct05")
> > DBSetProp('MonFile',"View","WhereType",3)
> >
> > DBSetProp('MonFile'+".ps_dep","Field","DataType","C(2)")
> > DBSetProp('MonFile'+".ps_dep","Field","UpdateName","Data1!oct05ps_dep")
> > DBSetProp('MonFile'+".ps_dep","Field","KeyField",.F.)
> > DBSetProp('MonFile'+".ps_dep","Field","Updatable",.T.)
> >
> > DBSetProp('MonFile'+".ps_no","Field","DataType","N(3)")
> > DBSetProp('MonFile'+".ps_no","Field","UpdateName","Data1!oct05.ps_no")
> > DBSetProp('MonFile'+".ps_no","Field","KeyField",.T.)
> > DBSetProp('MonFile'+".ps_no","Field","Updatable",.T.)
> >
> > DBSetProp('MonFile'+".py_nhrs","Field","DataType","N(6,2)")
> > DBSetProp('MonFile'+".py_nhrs","Field","UpdateName","Data1!oct05.py_nhrs")
> > DBSetProp('MonFile'+".py_nhrs","Field","KeyField",.F.)
> > DBSetProp('MonFile'+".py_nhrs","Field","Updatable",.T.)
> >
> > I copy and paste this code from the view SQL window in the view designer.
> > But I'm still getting the "No update tables are specified. Use the tables
> > property of the cursor" error message when I try to close the form.
> >
> >
> > "Mark" wrote:
> >
> > > Hi Don,
> > > You did not specify a KeyField and there are some typos e.g
> > >
> > > > DBSetProp('MonFile'+".ps_dep","Field","UpdateName","Data1!oct05ps_dep")
> > > should be (check the dot after oct05)
> > > > DBSetProp('MonFile'+".ps_dep","Field","UpdateName","Data1!oct05.ps_dep")
> > >
> > > The easiest way is to use GENDBC.PRG to a textfile and copy/paste it into
> > > your procedure.
> > >
> > > hth
> > > Mark
> > >
> > >
> > >
> > > "Don" wrote:
> > >
> > > > I created this view using the following code. Then I update the base file
> > > > using TABLEUPDATE(). When I close the form the CLOSE DATABASE command in the
> > > > unload method gets executed and it gives me the following error message.
> > > >
> > > > "No update tables are specified. Use the tables property of the cursor"
> > > >
> > > > But when I create this view in the view designer it works perfectly. But I
> > > > need to create the view within the program. Can anybody help me please?
> > > >
> > > > OPEN DATABASE data1
> > > >
> > > > CREATE SQL VIEW MonFile AS SELECT ps_dep, ps_no, py_nhrs ;
> > > > FROM data1!oct05 ;
> > > > WHERE ps_no = ( ?mEmp )
> > > >
> > > > DBSetProp('MonFile',"View","SendUpdates",.T.)
> > > > DBSetProp('MonFile',"View","BatchUpdateCount",1)
> > > > DBSetProp('MonFile',"View","CompareMemo",.T.)
> > > > DBSetProp('MonFile',"View","FetchAsNeeded",.F.)
> > > > DBSetProp('MonFile',"View","FetchMemo",.T.)
> > > > DBSetProp('MonFile',"View","FetchSize",100)
> > > > DBSetProp('MonFile',"View","MaxRecords",-1)
> > > > DBSetProp('MonFile',"View","Prepared",.F.)
> > > > DBSetProp('MonFile',"View","UpdateType",1)
> > > > DBSetProp('MonFile',"View","UseMemoSize",255)
> > > > DBSetProp('MonFile',"View","Tables","Data1!oct05")
> > > > DBSetProp('MonFile',"View","WhereType",3)
> > > >
> > > > DBSetProp('MonFile'+".ps_dep","Field","DataType","C(2)")
> > > > DBSetProp('MonFile'+".ps_dep","Field","UpdateName","Data1!oct05ps_dep")
> > > > DBSetProp('MonFile'+".ps_dep","Field","KeyField",.F.)
> > > > DBSetProp('MonFile'+".ps_dep","Field","Updatable",.T.)
> > > >
> > > > DBSetProp('MonFile'+".ps_no","Field","DataType","N(3)")
> > > > DBSetProp('MonFile'+".ps_no","Field","UpdateName","Data1!oct05ps_no")
> > > > DBSetProp('MonFile'+".ps_no","Field","KeyField",.F.)
> > > > DBSetProp('MonFile'+".ps_no","Field","Updatable",.T.)
> > > >
> > > > DBSetProp('MonFile'+".py_nhrs","Field","DataType","N(6,2)")
> > > > DBSetProp('MonFile'+".py_nhrs","Field","UpdateName","Data1!oct05py_nhrs")
> > > > DBSetProp('MonFile'+".py_nhrs","Field","KeyField",.F.)
> > > > DBSetProp('MonFile'+".py_nhrs","Field","Updatable",.T.)
> > > >
.
- References:
- RE: Uptating from a local view
- From: Don
- RE: Uptating from a local view
- From: Mark
- RE: Uptating from a local view
- Prev by Date: RE: Uptating from a local view
- Next by Date: Re: Append from CSV doesnt' handle dates very well
- Previous by thread: RE: Uptating from a local view
- Index(es):
Relevant Pages
|
Loading