I have this code:
It says, there is an error in the UPDATE statement. I have attatched the file, that I connect to.Code:Sub WriteToExcel() Dim strCn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Server.MapPath("vs_test.xls") & ";" & _ "Extended Properties=Excel 8.0;" Dim strSql As String = "update [Sheet1$] SET Value=55 WHERE Id=1;" Dim objConnection As New OleDbConnection(strCn) Dim objCommand As New OleDbCommand(strSql, objConnection) Dim objDataReader As OleDbDataReader objConnection.Open() objCommand = New OleDbCommand(strSql, objConnection) objCommand.ExecuteNonQuery() objConnection.Close() End Sub




Reply With Quote