Hi!!
Can any one help me get this info -
Update individual cells in Excel using ADO.NET

I keep getting error in the update statement.

Thanks for any help in advance!!

Here is my code -


Dim connString As String
connString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=ExcelData1.xls;" & _
"Extended Properties=""Excel 8.0;HDR=YES"""

objconnection = New OleDbConnection(connString)
objconnection.Open() 'open the connection

Dim cmd1 As New OleDbCommand
cmd1.Connection = objConnection

cmd1.CommandText = "INSERT INTO EmployeeData1 (Id, Name,
BirthDate) values ('AAA12', 'Andrew21', '12/4/1955')"

cmd1.ExecuteNonQuery()



cmd1.CommandText = "UPDATE [EmployeeData1] SET id = 'ad',
A2 = 'Cell F3'" ', F2 = 'Cell G3' where F1<>'1'"

cmd1.ExecuteNonQuery()

objConnection.Close()

Re: Use Ado.net to update individual cells in Excel by Steve

Steve
Wed Jul 28 09:01:00 CDT 2004

ty putting single quotes around and a dollar sign after the worksheet in
your statement
e.g
cmd1.CommandText = "UPDATE ['EmployeeData1$'] SET id = 'ad',
A2 = 'Cell F3'" ', F2 = 'Cell G3' where F1<>'1'"

"Lisa" <lisa555@hotmail.com> wrote in message
news:566e01c47449$fee1ebf0$a301280a@phx.gbl...
> Hi!!
> Can any one help me get this info -
> Update individual cells in Excel using ADO.NET
>
> I keep getting error in the update statement.
>
> Thanks for any help in advance!!
>
> Here is my code -
>
>
> Dim connString As String
> connString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
> "Data Source=ExcelData1.xls;" & _
> "Extended Properties=""Excel 8.0;HDR=YES"""
>
> objconnection = New OleDbConnection(connString)
> objconnection.Open() 'open the connection
>
> Dim cmd1 As New OleDbCommand
> cmd1.Connection = objConnection
>
> cmd1.CommandText = "INSERT INTO EmployeeData1 (Id, Name,
> BirthDate) values ('AAA12', 'Andrew21', '12/4/1955')"
>
> cmd1.ExecuteNonQuery()
>
>
>
> cmd1.CommandText = "UPDATE [EmployeeData1] SET id = 'ad',
> A2 = 'Cell F3'" ', F2 = 'Cell G3' where F1<>'1'"
>
> cmd1.ExecuteNonQuery()
>
> objConnection.Close()
>