Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update a table in a database with a view
Message
From
05/06/2007 06:20:55
 
 
To
05/06/2007 06:03:56
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01230467
Message ID:
01230489
Views:
27
Just a side note: I recommend that you ONLY use alltrim when you really need it, meaning almost never! In my experience, alltrim creates many more problems than it solves.

The same goes for PACK, PACK should only be used for maintainance once or twice per year.

>Now my code is like this, but still no effect. Isn't that strange?
>
>**************************************************************************
>
>CREATE SQL VIEW view5 AS SELECT &m_selectvelden FROM ALLTRIM(m_dbf2) WHERE SUBSTR(postcode, 1, 2) = ThisForm.cmbpostcode.DisplayValue
>
>USE view5
>=DBSETPROP('view5.uniekid','Field','KeyField',.T.)
>=DBSETPROP('view5.uniekid','Field','UpDatable',.F.)
>
>SELECT velden
>GO TOP
>DO WHILE NOT EOF()
> m_objectnm1 = 'view5.' + ALLTRIM(LOWER(veldnaam))
> m_veldnaam = ALLTRIM(LOWER(veldnaam))
> SELECT view5
> =DBSETPROP(ALLTRIM(m_objectnm1), 'Field', 'UpDatable', .T.)
> =DBSETPROP(ALLTRIM(m_objectnm1), 'Field', 'KeyField', .F.)
> =DBSETPROP(ALLTRIM(m_objectnm1), 'Field', 'UpdateName', ALLTRIM(m_dbf2) + '.' + ALLTRIM(m_veldnaam))
> SELECT velden
> SKIP
>ENDDO
>
>=DBSETPROP('view5', 'View', 'Tables', ALLTRIM(m_dbf2))
>=DBSETPROP('view5', 'View', 'WhereType', 1)
>=DBSETPROP('view5', 'View', 'SendUpdates', .T.)
>
>SELECT view5
>
>** Inhere I change some data..............
>BROW
>
>TABLEUPDATE(.T.)
>
>** Then closing te view...
>IF INDBC(ALLTRIM(m_alias), 'TABLE')
> SELECT ALLTRIM(m_alias)
> USE
> FREE TABLE ALLTRIM(m_dbf)
>ELSE
> SELECT ALLTRIM(m_alias)
> USE
>ENDIF
>
>CLOSE DATABASES ALL
>USE ALLTRIM(m_dbf) EXCL
>PACK
>
>ThisForm.Release
>
>RELEASE ALL
>CLOSE ALL
>CLEAR EVENTS
Previous
Reply
Map
View

Click here to load this message in the networking platform