Funkymonkey
04-12-2006, 10:40 AM
I've got my connection and can update the excel sheet from my webpage fine. Later on in the code I look up some updated cells from the sheet and display these in a label on my webpage. What I need to do is to save the spreadsheet after I update it (because it brings up old info otherwise). Here's my code:
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=ExcelTest.xls; Extended Properties=""Excel 8.0;"""
Dim cmd As New OleDbCommand("UPDATE [old$] SET Col1 = '" & timenow & "' WHERE Col2 = 'a'", strConn1)
Dim DACurrent As New OleDbDataAdapter("Select * from [old$B3:B3]", strConn)
Dim DANext As New OleDbDataAdapter("Select * from [old$B4:B4]", strConn)
DACurrent.Fill(DSCurrent)
DANext.Fill(DSNext)
First = DSCurrent.Tables(0).Columns(0).ColumnName
Second = DSNext.Tables(0).Columns(0).ColumnName
So when I update the sheet (at col 1), cells B3 and B4 get updated (as the formulas in these cells reference the one I just updated) and I then read these cells. How do I save the spreadsheet after the update and before I read these two cells???
Thanks loads!
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=ExcelTest.xls; Extended Properties=""Excel 8.0;"""
Dim cmd As New OleDbCommand("UPDATE [old$] SET Col1 = '" & timenow & "' WHERE Col2 = 'a'", strConn1)
Dim DACurrent As New OleDbDataAdapter("Select * from [old$B3:B3]", strConn)
Dim DANext As New OleDbDataAdapter("Select * from [old$B4:B4]", strConn)
DACurrent.Fill(DSCurrent)
DANext.Fill(DSNext)
First = DSCurrent.Tables(0).Columns(0).ColumnName
Second = DSNext.Tables(0).Columns(0).ColumnName
So when I update the sheet (at col 1), cells B3 and B4 get updated (as the formulas in these cells reference the one I just updated) and I then read these cells. How do I save the spreadsheet after the update and before I read these two cells???
Thanks loads!