Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using INLIST with select statement
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00417794
Message ID:
00417808
Views:
16
>I am trying to do a select statement using this INLIST(), It doesn't seems to work.
>
>for i = 1 to thisform.selectedlist.listcount
> if i < 2 then
> SQL_String = alltrim(thisform.selectedlist.ListItem(i))
> else
> SQL_String = SQL_String + "," + alltrim(thisform.selectedlist.ListItem(i))
> endif
>endfor
>
>select all a.cid, a.cname, b.csemester, b.ccourse, b.ccouroff, b.cstudent from sys_mast a, enroll b where a.cid = b.cstudent and INLIST(rtrim(b.csemester), SQL_String) into dbf c:\attend\temp
>
>when I brows the temp table it is empty.
>
>thank you for any help.
>

Is ERROR set OFF. If so you might not be seeing an error. I recently had an issue just like this where my list of possible selections was from about 3000 items. When the user selected to many I got an error (length of statement caused an invalid statement). What I ended up doing is instead of building a INLIST command I created a cursor and populated it. Then In my SQL I did a Select * From Table1 Where Fieldx In (Select Fieldy From CursorJustBuilt). There was really no visible speed difference when all but one of the 3000 were selected.

HTH,
REM
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform