Avatar of RohitYadav
RohitYadav
 asked on

Update query in C# to update a Excel spreadsheet

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

C#

Avatar of undefined
Last Comment
RohitYadav

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Bob Learned

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
RohitYadav

ASKER
Thanks,
I just figured it out also. :D Appreciate all your help bob.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck