sql - How to update excel sheet row from C# -
i'm frustrated because can't solve problem...
well, has been making desktop application in c#, complete application, have big problem.
my application import excel workbook has information showed in gridview. works ok, app update or modified data showed in gridview, 1 column called balance.
i want update column in excel workbook, update condition in sql, example have information imported app.
if modify in app row, example row has order "12345", want update in excel workbook column called balance of row.
i has been trying code:
string order = textbox1.text; string balance = textbox2.text; filepath = openfiledialog1.filename; extension = path.getextension(filepath); header = "yes"; oledbconnection myconnection = new oledbconnection(constr); ; oledbcommand mycommand = new oledbcommand(); string sql = null; myconnection.open(); mycommand.connection = myconnection; sql = "update [" + sheetname + "] set [" + sheetname + "].[order]=123 [" + sheetname + "].[balance]=12313"; mycommand.commandtext = sql; mycommand.executenonquery(); myconnection.close();
and if debug code sentence executed, , think ok, doesn't works.
update ['12234$'] set ['12234$'].[order]=123 ['12234$'].[balance]=12313
it give me error:
message=no value given 1 or more required parameters. source=microsoft access database engine
this thought - sql-like string set correctly?
if you're trying update balance order, you'd want in set command.
so, along lines of...
update ['12234$'] set ['12234$'].[balance]=12313 ['12234$'].[order]=12345
Comments
Post a Comment