Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ignore parameters with SQLExec?
Message
 
 
To
05/05/2011 14:49:12
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
MS SQL Server
Miscellaneous
Thread ID:
01509693
Message ID:
01509706
Views:
57
>>>I am working on a script to create a database in SQL Server 2008. The script includes the creation of UDFs, and at least one of those contains a "?" in the UDF. Since SQLDMO is apparently gone, I am working on using SQLExec() to execute the script. The problem is that SQLExec() is interpreting the "?" as a parameter (and prompting for a value) when it is not. Is there anyway to tell SQLExec() to ignore anything it interprets as a parameter?
>>>
>>>Thanks.
>>
>>Can you please explain about ? in the script? I'm trying to picture it and I can not.
>
>Parameters are preceded by a ? in remote SQL statements. For example
>
>SQLExec(lnConnection, "Select * from MyTable where MyField = ?MyParameter")
>
>If MyParameter variable is not defined, VFP will pop up a dialog asking for the value. Here is a line of code from a script that creates a UDF in SQL Server:
>
>-- select dbo.GETOCCURSWORD(@lcString,  'Canada', ' ,.!?', default)  --  Displays 4
>
>When I send the script with SQLExec(), VFP pops up a dialog with Enter the value for ', default) -- Displays 4. It is interpreting the ? as a parameter. I'm asking if there is a way to turn off that behavior.

Interesting that the ? in the string parameter is interpreted as a parameter. The only quick fix I can think of (and I don't like it) is to replace ? with CHAR (63)
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform