Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with SELECT statement
Message
From
28/11/1997 21:09:20
 
 
To
28/11/1997 08:29:18
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00062664
Message ID:
00062825
Views:
26
>>Can anyone show me the proper way to embed an SQL statement - specifically the SELECT statement - into an event (in my case the click event of a command button)
>>
>>Actually, I wanted to retrieve a login_id from my table, called tbl_staff, if the input login_id supplied by the user, in this case the login_id entered into a text box called cLoginID, exists in the table.
>>
>>I tried
>>
>>(line 1) =SELECT login_id;
>>(line 2) FROM tbl_staff;
>>(line 3) INTO cString2;
>>(line 4) WHERE login_id = ThisForm.cLoginID.value
>>
>>At Line 3, i wanted to store the return value into a variable so that i can check the variable to see whether it's a valid login_id based on whether the SELECT statement was successful or not
>>
>>When i run this particular form of mine and pressed the command button after entering a value into the text box, the program run stopped and gave me a message
>>
>> SELECT variable not found
>>
>>So...can anyone show me where i went wrong?
>
>See Paul's reply, he's got a good suggestion.
>I just want to add the reason why your SELECT don't work: the result of a SELECT must be put in a table, cursor or array. It cannot be a character variable.
>Here's the correct SELECT statement for your question:
>
>SELECT login_id;
>FROM tbl_staff;
>INTO CURSOR Temp;
>WHERE login_id = ThisForm.cLoginID.value
>
>cString2 = Temp.Login_ID
>USE

Thanks again to all who answered! :)
It was great help!

Mazlan Bin Mohammad
Previous
Reply
Map
View

Click here to load this message in the networking platform