Hello,
I am using VFP 9.0 manipulating data on a single table MS SQL 2005 database.
What I am trying to do is dump the content of the table nightly and upload new records, there are about 13k records and about 90% of them become obsolete daily, that I why I rather wipe out the data and upload fresh data.
I am getting the update conflict in cursor error when I try to delete the content of the table, I use this code in other places without this problem. The one thing that I am not sure if it is causing the conflict it that the name of the local table that I use as the seed is the same as the sql table that I am trying to populate, would this matter?
I will greatly appreciate any feedback you can provide.
* Begin Updating of remote table
*
OPEN DATABASE vinventory
SET DATABASE TO vinventory
DELETE VIEW vupload
*
CREATE SQL VIEW vupload;
REMOTE CONNECTION Reporting;
AS select saleshistory.StockCode, saleshistory.OnHand, saleshistory.Available, saleshistory.OnOrder, saleshistory.YtdSold, saleshistory.PrevYearSold, saleshistory.Supplier, saleshistory.Warehouse, saleshistory.KitsBfYtd, saleshistory.KitsBfPrev, saleshistory.YtdTotal, saleshistory.PrevTotal, saleshistory.FutureGross, saleshistory.FutureNet FROM saleshistory;
ORDER BY saleshistory.StockCode
*
DBSETPROP ("vupload", "View", "SendUpdates", .T.)
DBSETPROP("vupload" , "VIEW","WhereType",3)
DBSETPROP("vupload.stockcode", "Field", "Updatable", .T.)
DBSETPROP("vupload.onhand", "Field", "Updatable", .T.)
DBSETPROP("vupload.available", "Field", "Updatable", .T.)
DBSETPROP("vupload.onorder", "Field", "Updatable", .T.)
DBSETPROP("vupload.ytdsold", "Field", "Updatable", .T.)
DBSETPROP("vupload.prevyearsold", "Field", "Updatable", .T.)
DBSETPROP("vupload.supplier", "Field", "Updatable", .T.)
DBSETPROP("vupload.warehouse", "Field", "Updatable", .T.)
DBSETPROP("vupload.kitsbfytd", "Field", "Updatable", .T.)
DBSETPROP("vupload.kitsbfprev", "Field", "Updatable", .T.)
DBSETPROP("vupload.ytdtotal", "Field", "Updatable", .T.)
DBSETPROP("vupload.prevtotal", "Field", "Updatable", .T.)
DBSETPROP("vupload.futuregross", "Field", "Updatable", .T.)
DBSETPROP("vupload.futurenet", "Field", "Updatable", .T.)
*
DBSETPROP("vupload.stockcode", "Field", "UpdateName", [saleshistory.StockCode])
DBSETPROP("vupload.onhand", "Field", "UpdateName", [saleshistory.OnHand])
DBSETPROP("vupload.available", "Field", "UpdateName", [saleshistory.Available])
DBSETPROP("vupload.onorder", "Field", "UpdateName", [saleshistory.OnOrder])
DBSETPROP("vupload.ytdsold", "Field", "UpdateName", [saleshistory.YtdSold])
DBSETPROP("vupload.prevyearsold", "Field", "UpdateName", [saleshistory.PrevYearSold])
DBSETPROP("vupload.supplier", "Field", "UpdateName", [saleshistory.Supplier])
DBSETPROP("vupload.warehouse", "Field", "UpdateName", [saleshistory.Warehouse])
DBSETPROP("vupload.kitsbfytd", "Field", "UpdateName", [saleshistory.KitsBfYtd])
DBSETPROP("vupload.kitsbfprev", "Field", "UpdateName", [saleshistory.KitsBfPrev])
DBSETPROP("vupload.ytdtotal", "Field", "UpdateName", [saleshistory.YtdTotal])
DBSETPROP("vupload.prevtotal", "Field", "UpdateName", [saleshistory.PrevTotal])
DBSETPROP("vupload.futuregross", "Field", "UpdateName", [saleshistory.FutureGross])
DBSETPROP("vupload.futurenet", "Field", "UpdateName", [saleshistory.FutureNet])
*
DBSETPROP("vupload.stockcode", "Field", "KeyField", .t.)
*
USE vupload
GO BOTTOM
DELETE ALL NOOPTIMIZE
*
APPEND FROM saleshistory
*
CLEAR
CLOSE DATABASES ALL
CLOSE ALL
*
* End of Updating of remote table
I am using VFP 9.0 manipulating data on a single table MS SQL 2005 database.
What I am trying to do is dump the content of the table nightly and upload new records, there are about 13k records and about 90% of them become obsolete daily, that I why I rather wipe out the data and upload fresh data.
I am getting the update conflict in cursor error when I try to delete the content of the table, I use this code in other places without this problem. The one thing that I am not sure if it is causing the conflict it that the name of the local table that I use as the seed is the same as the sql table that I am trying to populate, would this matter?
I will greatly appreciate any feedback you can provide.
* Begin Updating of remote table
*
OPEN DATABASE vinventory
SET DATABASE TO vinventory
DELETE VIEW vupload
*
CREATE SQL VIEW vupload;
REMOTE CONNECTION Reporting;
AS select saleshistory.StockCode, saleshistory.OnHand, saleshistory.Available, saleshistory.OnOrder, saleshistory.YtdSold, saleshistory.PrevYearSold, saleshistory.Supplier, saleshistory.Warehouse, saleshistory.KitsBfYtd, saleshistory.KitsBfPrev, saleshistory.YtdTotal, saleshistory.PrevTotal, saleshistory.FutureGross, saleshistory.FutureNet FROM saleshistory;
ORDER BY saleshistory.StockCode
*
DBSETPROP ("vupload", "View", "SendUpdates", .T.)
DBSETPROP("vupload" , "VIEW","WhereType",3)
DBSETPROP("vupload.stockcode", "Field", "Updatable", .T.)
DBSETPROP("vupload.onhand", "Field", "Updatable", .T.)
DBSETPROP("vupload.available", "Field", "Updatable", .T.)
DBSETPROP("vupload.onorder", "Field", "Updatable", .T.)
DBSETPROP("vupload.ytdsold", "Field", "Updatable", .T.)
DBSETPROP("vupload.prevyearsold", "Field", "Updatable", .T.)
DBSETPROP("vupload.supplier", "Field", "Updatable", .T.)
DBSETPROP("vupload.warehouse", "Field", "Updatable", .T.)
DBSETPROP("vupload.kitsbfytd", "Field", "Updatable", .T.)
DBSETPROP("vupload.kitsbfprev", "Field", "Updatable", .T.)
DBSETPROP("vupload.ytdtotal", "Field", "Updatable", .T.)
DBSETPROP("vupload.prevtotal", "Field", "Updatable", .T.)
DBSETPROP("vupload.futuregross", "Field", "Updatable", .T.)
DBSETPROP("vupload.futurenet", "Field", "Updatable", .T.)
*
DBSETPROP("vupload.stockcode", "Field", "UpdateName", [saleshistory.StockCode])
DBSETPROP("vupload.onhand", "Field", "UpdateName", [saleshistory.OnHand])
DBSETPROP("vupload.available", "Field", "UpdateName", [saleshistory.Available])
DBSETPROP("vupload.onorder", "Field", "UpdateName", [saleshistory.OnOrder])
DBSETPROP("vupload.ytdsold", "Field", "UpdateName", [saleshistory.YtdSold])
DBSETPROP("vupload.prevyearsold", "Field", "UpdateName", [saleshistory.PrevYearSold])
DBSETPROP("vupload.supplier", "Field", "UpdateName", [saleshistory.Supplier])
DBSETPROP("vupload.warehouse", "Field", "UpdateName", [saleshistory.Warehouse])
DBSETPROP("vupload.kitsbfytd", "Field", "UpdateName", [saleshistory.KitsBfYtd])
DBSETPROP("vupload.kitsbfprev", "Field", "UpdateName", [saleshistory.KitsBfPrev])
DBSETPROP("vupload.ytdtotal", "Field", "UpdateName", [saleshistory.YtdTotal])
DBSETPROP("vupload.prevtotal", "Field", "UpdateName", [saleshistory.PrevTotal])
DBSETPROP("vupload.futuregross", "Field", "UpdateName", [saleshistory.FutureGross])
DBSETPROP("vupload.futurenet", "Field", "UpdateName", [saleshistory.FutureNet])
*
DBSETPROP("vupload.stockcode", "Field", "KeyField", .t.)
*
USE vupload
GO BOTTOM
DELETE ALL NOOPTIMIZE
*
APPEND FROM saleshistory
*
CLEAR
CLOSE DATABASES ALL
CLOSE ALL
*
* End of Updating of remote table