Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to update SQL table from FoxPro cursor

Status
Not open for further replies.

Niki_S

Programmer
Jun 4, 2021
232
LK
I need to update my SQL server data from my foxpro9 cursor. I made a code in my program, but it is not working.
This is how I used my code,

Code:
stra="select  nParaID, cParaNo, cParaYear, cParaCD from MIS.dbo.wshPara  WHERE cParaCD=?thisform.cboFactory.value+'c'"
SQLEXEC(hndOps,stra,'wshPara')

SELECT * FROM wshPara INTO Dbf C:\TEMPFILES\wsh_Fac

SELECT nParaID,val(cParaNo)+1 AS nParaNo ,cParaYear, cParaCD FROM wsh_Fac INTO Dbf C:\TEMPFILES\wsh_Fac2

SELECT nParaID,str(nParaNo) as cParaNo,cParaYear, cParaCD FROM wsh_Fac2 INTO Dbf C:\TEMPFILES\wash_factory
SELECT nParaID,str(nParaNo) as cParaNo,cParaYear, cParaCD FROM wsh_Fac2 INTO CURSOR Wash


Update MIS.dbo.wshPara Set cParaNo= t2.cParaNo From wash_factory as t1 Inner Join MIS.dbo.wshPara as t2 On t1.nParaID= t2.nParaID

My SQL server table is MIS.dbo.wshPara and my foxpro9 cursor is Wash.

Can someone please help m to do this?
Thanl you.
 
This is the fifth thread you have started concering the updating of your SQL Server table. We have been trying to answer each of your separate questions in turn, but instead of following up our suggestions, you just start a new thread. This is unhelpful.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hello,

pls. do not be offended but it seems that you are starting to learn sql and VFP.

Maybe the easiest way would be :
make a backup
make a database in VFP
add a remote view in vfp with the fields, joins and conditions you need (do not forget to set send updates checkmark and which fields to write back)
use it
do changes
tableupdate()

And please do not write "not working" , write the error message and where it occurs.

regards
tom



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top