I have a classic ASP web application that updates a table in a Excel spreadsheet.
I am using the following to connect to the Excel file
Set rows = CreateObject("ADODB.Recordset")
objConnection.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & Server.MapPath("data.xlsx") & ";" & _
"Extended Properties=" & Chr(34) & "Excel 12.0 Xml;HDR=Yes" & Chr(34) & ";"
That is a sample query that I am executing
query = "UPDATE [Sheet1$] SET [STATUS] = 'unclaimed', [CLAIMER] = '' ,[SDATE] = '"
& DATE & "' WHERE [JUR] = '" & in_jur & "' AND [WC] = " & in_wc
objConnection.Execute query,numRows,adExecuteNoRecords
The above query gets executed in the process.asp page when the user clicks on a button that calls a javascript function that sends the value of in_jur and in_wc like this
function sendForProcessing() {
somejur = //use the document.getElementByID to get selected jur
somewc = //use the document.getElementByID to get selected wc
window.location = process.asp?in_jur=somejur&in_wc=somewc
}
The application updates the sheet correctly for some time (i counted the number of times it works. 1st test: 10 times 2nd test: 16 times it just varies) and then it stops working. I do not get error message in the objConnection.Execute.
When i print out the numRows it prints 1.
Is there a better way to update the row in Excel?