Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Something wrong with my codes?
Message
From
08/08/2003 08:52:49
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/08/2003 07:53:32
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00818128
Message ID:
00818151
Views:
21
>dear all,
>
>can anybody help me? is there something wrong with my code, because it doesn't work in my program:
>
>1. i want to add a field in a cursor crsCodeAll.
>
>******* it doesn't work ********
>SELECT * FROM Library!tCodeWord;
> UNION;
>SELECT * FROM Library!tCodeName;
>ORDER BY 1;
>INTO CURSOR crsCodeAll READWRITE
>
>ALTER TABLE crsCodeAll ADD COLUMN lselected n(1)
>
>
>
>******** it works very well *******
>CREATE CURSOR crsKodeAll (ckata c(15), ckode c(4), lselected n(1))
>
>SELECT * FROM Library!tCodeWord;
> UNION;
>SELECT * FROM Library!tCodeName;
>ORDER BY 1;
>INTO TABLE tqCodeAll
>
>ALTER TABLE tqCodeAll ADD COLUMN lselected n(1)
>
>SELE crsCodeAll
>APPEND FROM tqCodeAll
>
>
>2. i want to copy some data, but it won't appear in my Grid.
>
>local lcCode
>
>lcCode='US'
>
>SELE crsCodeAll
>COPY TO crsSearch FOR cCode=lcCode
>
>ThisForm.Grid1.RecordSource='crsSearch'
>ThisForm.Grid1.Refresh()

Gloria,
When saying "it doesn't work" what do you mean ? An error occurs ? If so what's the error (Unions not compatible ? Invalid operation for the cursor ?) ? Second occurs when you have long field names (seeing your second code works I guess error is this).
You could workaround directly including lSelected as a new field. ie :
Select *, 0x7FFFFFFF * 0 as lSelected from Library!tCodeWord ;
union ;
Select *, 0x7FFFFFFF * 0 as lSelected from Library!tCodeName ;
order by 1 ;
into cursor crsCodeAll readwrite
2)
local lcCode
lcCode='US'

ThisForm.Grid1.RecordSource=''

SELE crsCodeAll
COPY TO crsSearch FOR cCode=lcCode

ThisForm.Grid1.RecordSource='crsSearch'
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform