How oledb read and write excel
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Establish a connection to the data source.
Dim Fle As String = Server.MapPath("pchart.xls")
Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Fle _
& ";" & "Extended Properties=""Excel 8.0;"""
Dim objConn As New System.Data.OleDb.OleDbConnection(sConnectionString)
objConn.Open()
'Add two records to the table.
Dim objCmd As New System.Data.OleDb.OleDbCommand
objCmd.Connection = objConn
objCmd.CommandText = "Update [PC-CD-19$] set x4 = 223.456 where x1 = 'y78'"
objCmd.ExecuteNonQuery()
'Close the connection.
objConn.Close()