Script Insert to SQL Server?

How to write script insert to sql server when cilck button


Hello captain,

First you need to create a Datasets > Queries like the one below:
image

Then in Draw you create a button, double click in this object and it will open a window like this, and click in “New”
image

It will open in CodeBehind a new method that will be executed every time you click in the button.
In this method you can add this line to do a SELECT command:
@Dataset.Query.Query1.SelectCommand();

For other statements like INSERT, UPDATE… you can use like this:
@Dataset.Query.Query1.ExecuteCommand();

If you want to edit the SQLStatement in runtime, you can use this line
@Dataset.Query.Query1.SqlStatement = "<SQLStatement>";

Hope this helps, if you need anything else let us know please.

Best Regards,
Eduardo.