Marcel
|
| Posted: 12/06/2004, 1:21 PM |
|
Im trying the CCDLookUp Function, the SQL statement seems right... but I receive this error:
Source: CCDLookUp function
Command Text: SELECT Price FROM art WHERE Co_art = 5001HF328-GR00
Error description: [Microsoft][ODBC Visual FoxPro Driver]Command contains unrecognized phrase/keyword. (Microsoft OLE DB Provider for ODBC Drivers)<br>
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 12/06/2004, 1:26 PM |
|
I believe that text values must be enclosed in quotes, therefore your SQL would need to look like:
SELECT Price FROM art WHERE Co_art = '5001HF328-GR00'
You can also test your SQL directly in FoxPro to check if it works there.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Marcel
|
| Posted: 12/06/2004, 2:48 PM |
|
This is my code:
Orders_Detail.Price1.value = CCDLookUp("Price", "articles", "co_art ="& Request.QueryString("s_co_art"), DBConnection3)
I changed it to: (extra quotes in : ( " ' s_co_art ' " ) without spaces)
Orders_Detail.Price1.value = CCDLookUp("Price", "articles", "co_art ="& Request.QueryString("'s_co_art'"), DBConnection3)
and received this error:
Source: CCDLookUp function
Command Text: SELECT Price FROM art WHERE co_art =
Error description: [Microsoft][ODBC Visual FoxPro Driver]Missing operand. (Microsoft OLE DB Provider for ODBC Drivers)<br>
***********************************************************
Im trying to get some values from one table, and insert them in another table... theres another way to achieve this?
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 12/06/2004, 3:05 PM |
|
This should be the right method, as long as you structure your SQL properly. You don't need to enclose the parameter of QueryString in quotes, just the value that will be used in the SQL. The ToSQL method should be the best for this for couple reasons.
Take a look at http://forums.codecharge.com/posts.php?post_id=54032
and some ToSQL usage examples: http://docs.codecharge.com/studio/html/Components/Funct.../CCDLookUp.html http://docs.codecharge.com/studio/html/ProgrammingTechn...gleDBValue.html
Just use ccsText as ToSQL parameter, instead of ccsInteger.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Oper
Posts: 1195
|
| Posted: 12/06/2004, 5:14 PM |
|
if cod_art is Alphanumeric you need to enclose the Single apostrophe like this:
Orders_Detail.Price1.value = CCDLookUp("Price", "articles", "co_art =' " & Request.QueryString("s_co_art") & " ' ", DBConnection3)
I added few spaces you to make it easy for you to see the single apostrophe 1 after the = and the other enclosed beetween doble " ' "
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
mrachow
Posts: 509
|
| Posted: 12/07/2004, 12:47 AM |
|
Only meant as a suggestion.
I would always recommend to sent pieces of an sql statement through the ToSql function. In that case
DBConnection3.ToSQL(Request.QueryString("s_co_art"), ccsText)
Of course the SQL surrounding of text with ' ' is unlikely to be changed ever. But I always use that function and don't have to take care about SQL syntax especially on date values.
If the type of a column changes I had to change the second parameter only.
_________________
Best regards,
Michael |
 |
 |
Marcel
|
| Posted: 12/07/2004, 1:50 PM |
|
Thanks Oper.... YOU SAVE MY LIFE....!
It works great now,... as you can see Im not "a programmer" and I was searching the web for almost a week trying to solve this...
again... THANKS....
|
|
|
 |
|