Insert data with multiple parameter using SqlDatasource.Insert

By bryan tugade

We can use SqlDatasource.insert event to insert data with multiple parameter.

Assuming that you would like to use sqldatasource control to insert data to your database and you have a multiple parameter that need to pass before inserting it. This is one way to insert data.

SqlDataSource2.InsertParameters("param1").DefaultValue =value1
SqlDataSource2.InsertParameters("param2").DefaultValue = value2
SqlDataSource2.InsertParameters("param3").DefaultValue = value3
SqlDataSource2.InsertParameters("param4").DefaultValue = value4
SqlDataSource2.Insert()

Related FAQs

In C#, we can select and deselect checkbox in gridview in onPostback event of checkbox in gridview header.
This topic will show us on how to search a data in a database using SqlMethods.Like in Linq to Sql
We can select multiple fields in a given database tables using Linq to sql. I use AdventureWorks as my database in this sample app and to show you how it works i bind the results in gridview control.
This topic will show us on how to find data that starts with a given character using StartsWith function in Linq to Sql.
Finding controls like hiddenfield, dropdownlist inside gridview on rowdatabound event and assign the value of hiddenfield in the dropdownlist bound in SqlDataSource.
We can filter data using dataview.
Insert data with multiple parameter using SqlDatasource.Insert  (1544 Views)