troubleshooting Question

Update query in C# to update a Excel spreadsheet

Avatar of RohitYadav
RohitYadav asked on
C#
2 Comments1 Solution4807 ViewsLast Modified:
Hi,
I am trying to update a excel sheet creating an OleDB connection.
I am able to retrieve records but I am an unable to update any records.
This is what my query looks like:


Update  [Sheet1$] SET F14='HP935' WHERE Manufacturer='Proliant DL585 Server' AND Product Description='Hewlett-Packard' AND ProductNumber='DL585'

And this is the error i get:
{System.Data.OleDb.OleDbException: Syntax error (missing operator) in query expression 'Manufacturer='Proliant DL585 Server' AND Product Description='Hewlett-Packard' AND ProductNumber='DL585''.
   at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
   at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
   at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
   at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
   at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()

Any help is appreciated.
Thanks

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros