Tag Archives: SQLConnection

Creating and Using TextBox in Rows Like An Array To Update Multiple Records At Once In Asp.Net

Updating multiple data at multiple rows in table is very often process on web application. Especially on interal / private system.

We have to make a grid like excel to do that. User inputs their data into multiple textboxes in rows / cells then clicks submit button to update those data at once.

Asp.Net server input control has many ways to access list of textboxes. Not only using array like asp classic do but we can do it using repeater / listview / gridview / table control as a grid creator and use FindControl method to access control inside grid including textboxes.

I have an example to update email of many customers so that when submit button is clicked then related email textboxes text will be stored on database.

I use VS 2010 and my local SQL Express 2005 with Northwind sample database to make this example.
Continue reading

Cancelling ADO.NET DataAdapter.Fill Method On The Fly By Throwing An Error

ADO.NET DataAdapter is a bridge between data source and DataSet. The implementation of DataAdapter can be SQLDataAdapter, OLEDBDataAdapter, iDB2DataAdapter etc. DataAdapter.fill method fills data source recordset to a DataSet or DataTable returned by a ‘select’ query.
After populating to a DataSet and DataTable, database connection can be closed but DataTable data still able to access. This is known as Disconnected ADO.Net operation.
We do not have to re-connect to database if we want to retrieve same data with previously DataAdapter.Fill work. We can access the DataTable’s data like an array.
Because of that performance of disconnected operation is better compared with connected one in some cases.

If the ‘select’ query has result of thousands or millions record DataAdapter.Fill method will populate them all thus long run might occur, DataAdapter.Fill looks like slow.
However there is no default method to cancel DataAdapter.Fill. So to terminate long Fill process we have to kill it manually and the application will close.
We need to know how to cancel DataAdapter.Fill on the fly for particular reason.

Continue reading