I wrote a code to export my data in gridview to excel
Hi,
I wrote a code to export my data in gridview to excel. But at runtime it throws an exception saying "syntax error in INSERT TO" on execution of the command. I stepped through the code to see the output of the sql statement and I see nothing wrong with it. Can anyone assist me quickly on this please? Very many thanks in advance.
NB: The table creates perfectly, but the INSERT statement gives the exception.
I attached my source code here for your perusal.
Answers (6)
2
here is an example
you may have to change according to your table:
- CREATE TRIGGER trg_Update_Qty
- ON Stock
- AFTER UPDATE
- AS
- UPDATE Stock SET Keterangag = 0 FROM inserted WHERE inserted.qty = 0 and inserted.kode_barang = Stock.kode_barang
- GO
please mark the answer as accepted if it satisfies your question
Accepted 1
I assume you want to delete the data in the last column from table when qty = 0.
write a trigger on that table in check if qty=0, then delete data in last column i.e. set it to 0
0
you can show me example code?