Update data in SQL Server with scan function VFP

I want to update data in SQL Server using VFP 8. Below is my code

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>create cursor skedul1 (norekening N(13), ke N(2), pokok_kr N(12), bunga_kr N(12), pokok_sd N(12))
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.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
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
</code>
<code>create cursor skedul1 (norekening N(13), ke N(2), pokok_kr N(12), bunga_kr N(12), pokok_sd N(12)) 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.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 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 </code>
create cursor skedul1 (norekening N(13), ke N(2), pokok_kr N(12), bunga_kr N(12), pokok_sd N(12))
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.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

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

Only one row has been changed. Can someone corrected my script?

note.. at variable m.value1 until m.value5 suppose be write with skedul1 not skedule1 also m.value4 = skedul1.pokok_sd

2

What made you think you only insert one row? It inserts all of them and these lines were totally unnecessary:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>SET SAFETY OFF
SELECT skedul1
Zap
Set Safety off
select skedul1
</code>
<code>SET SAFETY OFF SELECT skedul1 Zap Set Safety off select skedul1 </code>
SET SAFETY OFF
SELECT     skedul1
Zap
Set Safety off
select skedul1

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật