Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update with SQL Pass Through
Message
From
21/01/2014 15:04:35
Mike Yearwood
Toronto, Ontario, Canada
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01592099
Message ID:
01592247
Views:
62
If you are just starting out with SQL Pass Through - I suggest you look into cursor adapters. You can extract 5 columns of data with a first query, let the user pick a record, grab the rest of the columns for that single record, let the user edit that, and update it back to the server. It is a lot better than custom coding your queries and update commands separately.

>You are correct, that was my problem
>
>Thanks a bunch
>Jon
>
>>Hi Jon
>>
>>In your select query you are using like. In your update you used =. Just in case you missed it, the % at the end of m.cSelectedJob would make the update fail.
>>You added the dbo schema to your select query, but not to the update query. If the default schema is not dbo, and the default schema has a MasterCostCodeList, your update would not happen in dbo. I'd include dbo in the update query too.
>>
>>Glad to see you're passing parameters via ? as it goes a long way toward preventing SQL Injection Attacks.
>>
>>UPDATE dbo.MasterCostCodeList SET Active = 1 where level1 = ?m.cSelectedJob
>>
>>
>>>I'm messing around with "SQL Pass-Through" and I'm able to pull data pretty easily but how would I UPDATE data in a SQL Server 2000 table using SQL Pass-Through?
>>>
>>>here is my select statement, which works well.
>>>
>>>
>>>m.nConnectionHandle = SQLCONNECT('TimeClockPlusTest')
>>>m.cSelectedJob = '16536%'
>>>
>>>TEXT TO lcCmd NOSHOW PRETEXT 15
>>>
>>>select CostRecordId, Level1, Active from dbo.MasterCostCodeList  where level1 like ?m.cSelectedJob
>>>
>>>ENDTEXT
>>>
>>>=SQLEXEC(m.nConnectionHandle,lcCmd,'CostCodeInfo')
>>>
>>>=SQLDISCONNECT(m.nConnectionHandle)
>>>
>>>
>>>What I'd like to update
>>>
>>UPDATE MasterCostCodeList SET Active = 1 where level1 = ?m.cSelectedJob
>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform