View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
timothym timothym is offline
external usenet poster
 
Posts: 1
Default Writing to Excel using ASP.NET

Private Sub Page_Load(ByVal sender As System.Object, ByVal e A
System.EventArgs) Handles MyBase.Load

Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Dat
Source='C:\Timmy\Demographic Application\CENTRAL.XLS';Extende
Properties=""Excel 8.0;HDR=NO"""
Dim conn As New OleDbConnection(strConn)
Dim strSQL As String = "UPDATE [General$A86:A86] SET F1
2000"
Dim cmd As New OleDbCommand(strSQL)
cmd.Connection = conn
conn.Open()
Dim rows As Integer = cmd.ExecuteNonQuery()
cmd.Connection.Close()
conn.Close()
conn = Nothing
End Sub

Hi!

I found the following code (or very similar) in an example. I want t
write to the A86 cell of the General sheet in the workbook mentione
in the connection string. However, the problem is that after I run th
asp.net test example above, and then try to open the spreadsheet, Exce
says that there is a "memory write problem" and also that it is locke
for editing. I cannot even delete the spreadsheet because Windows say
there is a sharing violation. I do not know what is really wrong wit
the above code as I practically copied it from the MSDN website.
would greatly appreciate any help!

Thanks!
Timoth

--
Message posted from http://www.ExcelForum.com