Dear Expert...
I use VFP8 for SQL Server data processing,
I have a question, how to code or script to update data in SQL Server using Create Cursor VFP.
For example, below is the script that I use.
when I run this script, why only the first line can change..
i need solution..
also if i use this skrip i got warning that :
Connectivity error: [Miscrosoft][ODBC SQL Server Drive][SQL Server] Invalid Object Name 'skedul1'
below script that i used for update value on my SQL Server
Thank you for the advice and enlightenment from the experts on this forum..
I use VFP8 for SQL Server data processing,
I have a question, how to code or script to update data in SQL Server using Create Cursor VFP.
For example, below is the script that I use.
Code:
create cursor skedul1 (norekening N(13), ke N(2), pokok_kr N(12), bunga_kr N(12), pokok_sd N(12))
SET SAFETY OFF
SELECT skedul1
ZAP
SET SAFETY ON
insert into skedul1 (norekening, ke, pokok_kr, pokok_sd, bunga_kr) values (1312124120052, 1, 0, 26400, 850000)
insert into skedul1 (norekening, ke, pokok_kr, pokok_sd, bunga_kr) values (1312124120052, 2, 0, 26400, 850000)
insert into skedul1 (norekening, ke, pokok_kr, pokok_sd, bunga_kr) values (1312124120052, 3, 0, 26800, 850000)
insert into skedul1 (norekening, ke, pokok_kr, pokok_sd, bunga_kr) values (1312124120052, 4, 0, 26400, 850000)
insert into skedul1 (norekening, ke, pokok_kr, pokok_sd, bunga_kr) values (1312124120052, 5, 0, 25500, 850000)
insert into skedul1 (norekening, ke, pokok_kr, pokok_sd, bunga_kr) values (1312124120052, 6, 850000, 26400, 0)
select skedul1
m.value1 = skedule1.norekening
m.value2 = skedule1.ke
m.value3 = skedule1.pokok_kr
m.value4 = skedule1.pokok_sd
m.value5 = skedule1.bunga_kr
TEXT TO m.lcSQL TEXTMERGE noshow
UPDATE dbo.skedul
SET pokok_kr = ?m.value3,
pokok_sd = ?m.value4,
bunga_kr = ?m.value5
WHERE norekening = ?m.value1 and ke = ?m.value2
ENDTEXT
when I run this script, why only the first line can change..
i need solution..
also if i use this skrip i got warning that :
Connectivity error: [Miscrosoft][ODBC SQL Server Drive][SQL Server] Invalid Object Name 'skedul1'
below script that i used for update value on my SQL Server
Code:
Select skedul1
m.value1 = skedul1.norekening
m.value2 = skedul1.ke
m.value3 = skedul1.pokok_kr
m.value4 = skedul1.pokok_sd
m.value5 = skedul1.bunga_kr
TEXT TO m.lcSQL TEXTMERGE noshow
UPDATE dbo.skedul
SET pokok_kr = ?m.value3,
pokok_sd = ?m.value4,
bunga_kr = ?m.value5
FROM [skedul1]
WHERE rekening = ?m.value1 and ke = ?m.value2
ENDTEXT
lnResult = SQLExec(Thisform.nHandle, m.lcSQL)
If m.lnResult < 0
Aerror(aWhy)
Messagebox(aWhy[2])
SQLDisconnect(0)
Return .F.
Else
Messagebox("Data Telah Update..!!")
thisform.PopulateGrid()
thisform.grid2.RecordSource = ""
Endif
Thank you for the advice and enlightenment from the experts on this forum..