Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update - SQL (Error 1806)
Message
 
 
À
24/07/2001 00:03:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00534232
Message ID:
00534272
Vues:
81
This message has been marked as a message which has helped to the initial question of the thread.
Hi!

Well, this weird behavior have even an explanation...

From my point of view, SQL commands often work in their own context, so when you use with...endwith, the .property could fail. Why? Whell, when you call the PRG file or other method, with...endwith supposed to work across the procedure call. However, there is a bug in VFP that makes this feature not reliable. It seems this bug pops up here too.
I often get the same thing with INSERT and REPLACE commands as well.

Conclusion: never use .property reference in such commands that work with data. When you have a long objects reference chain, do following:

x=thisform.....MyObject
UPDATE ... SET ... = x.property

HTH.

>Hi all,
>
>I get this error when I try to use WITH-ENDWITH in an Update-SQL command.
>
SQL: Column "field | variable" is not found (Error 1806), the field or variable you specified cannot be found.
>
>To reproduce the error:
>
create cursor test (fld1 c(10), fld2 c(10), fld3 i)
>x=createobject('doTest')
>with x
>  .xfld1 = 'Hello'
>  .xfld2 = 'World'
>  .xfld3 = 1
>  *-- work fine
>  insert into test values (.xfld1, .xfld2, .xfld3)
>  browse
>  *-- no problem here
>  m.fld1 = .xfld1
>  m.fld2 = .xfld2
>  m.fld3 = .xfld3
>  update test set fld1 = m.fld1, fld2 = m.fld2, fld3 = m.fld3 where fld3 = 1
>  browse
>  *-- explicitly including the object prefix; still no problem here!
>  update test set fld1 = x.xfld1, fld2 = x.xfld2, fld3 = x.xfld3 where fld3 = 1
>  browse
>  *-- now, using the .property inside the WITH-ENDWITH construct. Error 1806!
>  update test set fld1 = .xfld1, fld2 = .xfld2, fld3 = .xfld3 where fld3 = 1
>  browse
>endwith
>
>define class doTest as session
>  xfld1 = ''
>  xfld2 = ''
>  xfld3 = 0
>enddefine
>
>Does anyone know of this problem? I can't find an entry in the Apr 2001 MSDN DVD using keywords: VFP AND Update AND SQL or Foxpro AND Update AND SQL.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform