How do I put this DBMS.OUTPUT_PUT.LINE in a database, and is it also allowed to put it on listbox, datagridview or label?
example: [Time]: "NAME" has inserted a data.
How do I put this DBMS.OUTPUT_PUT.LINE in a database, and is it also allowed to put it on listbox, datagridview or label?
example: [Time]: "NAME" has inserted a data.
If you are trying to get additional text data from an operation to be returned from a SQL operation similar to how DBMS_OUTPUT.PUT_LINE
works, then PRINT
allows that. Since you mention C#, you should note that to consume PRINT
data you need to subscribe to the SqlConnection.InfoMessage
event, as described here.
However, in most cases it is more suitable / pragmatic to SELECT
(perhaps via OUTPUT
-clause in the case of INSERT
/DELETE
operations) something that informs the UI - perhaps the rows, perhaps the @@ROWCOUNT
, perhaps the SCOPE_IDENTITY()
. PRINT
is usually a bad option for anything other than tool scripts.