Monthly Archives: May 2012

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

Introduction To Asp .Net Ajax Client Side Development ($get, $addhandler, $removehandler, Sys.Application, Sys.WebForms, Sys.Net)

Asp .Net Ajax has many ways to accomplish simple and complex web application requirement. As a brief Asp.Net Ajax has Server and Client Side development.
Often Server and Client Side mixed to make Ajax development more confinient.

Server side development process UI update by sending a response from server machine whereas Client side process all UI update on client or user machine side.
In development point of view, Server side code is simpler. But the process uses more resources on server machine. Client side code requires more Js scripting, so in the end our client script may be much longer than server side script.
Client side Ajax development is more suitable for web applications that have complex user interaction since its doesn’t consume server resouces to update the UI.
But off course, your app logic still remains on server side.

I use Microsoft Ajax Library to simplify client side development. This Ajax Library is a rich framework and used extensively at client script.

If you are new to Asp.Net Ajax then you should visit my previous posts about Ajax Server Controls. I explained and gave example of Asp .Net Ajax for Server side development. Please visit these Urls:Introduction To Asp .Net Ajax (ScriptManager, UpdatePanel, ContentTemplate, Triggers) and Introduction to Asp .Net Ajax – 2 (UpdateProgress).
At general, we have to include controls like ScriptManager, UpdatePanel with its child tag <ContentTemplate> and <Triggers>, and also UpdateProgress.
ScriptManager is must to enable Ajax request. UpdatePanel contains all control which will have Ajax Process and UpdateProgress acts as progress info to indicate that asynchronous process is still working.

Continue reading

Manage DB2 Table Security and Accessing It Using PHP

Security always considered on many application especially when dealing with e-commerce. DB2 has an ability to set table security with only one line of codes.

Some tables might be accessed by public or anonymous users but others can only be accessed by private users. In order to set that we need to understand grant and revoke DB2 syntax.

Grant is giving user some permissions to a table whereas Revoke is taking user from some table permissions.

I will give example of DB2 syntaxes to set tables security start from creating DB2 instance, create a database, schema, table and grant tables. Also there is PHP web apps to ‘select’, ‘insert’ and ‘update’ to these tables. I’ve used Windows OS and DB2 (ver)..

I am using db2admin user to set initial configuration. db2admin is OS and DB2 user created when I installed DB2 software. db2admin acts as administrator in DB2. FYI DB2 user is also OS user.

Continue reading

Upload File With Asp .Net AsyncFileUpload Ajax Control Inside ModalPopupExtender

Asp .Net makes upload file process is easy task. As long as the server upload directory has sufficient permission, we can save file to that directory. Beside that we can specify what kind of file we want to save.

AsyncFileUpload is an Ajax Control to upload file asynchronously. Click on browse/select file button and choose file location then the control will automatically upload the file to server. The file uploading results can be checked both in the server and client sides.

Its basic tag example is <ajaxToolkit:AsyncFileUpload ID=”asyncfileupload1″ runat=”server” OnClientUploadComplete=”uploadcomplete” OnClientUploadError=”uploaderror” />. It have client event OnClientUploadComplete contains client script function that execute when upload file is success and OnClientUploadError is same but execute when upload file is error.
Other client event is OnClientUploadStarted executes when upload process started.
Also it have server event UploadedComplete and UploadedFileError that execute on server when upload file is success and error respectively.
For complete description explanation about AsyncFileUpload please refer to link

In this post, I will write example of AsyncFileUpload Ajax Control along with ModalPopup Extender as container. I already have example of using ModalPopupExtender Ajax Control at this link Create a PopUp Dialog with ModalPopupExtender AjaxControlToolkit
This example will only allow image (jpg, gif, png) file to be uploaded.

Continue reading

Understanding Asp .Net CascadingDropDown AjaxControlToolkit Tutorial

Populating DropDown is a common process in web application. We can set dropdown listitem manually or load from array / database.

Sometimes we deal with more than one dropdown that related to each other. It calls Cascading DropDown.

Many ways to create Cascading DropDown with asp .net which are using autopostback that page refresh everytime dropdown item selected, plain asp .net ajax that only reload partially and using CascadingDropDown Ajaxcontroltoolkit that also use ajax process.

The benefit of using CascadingDropDown Ajaxcontroltoolkit are increasing productivity due to a lot of design work has been done in its functionality and also the web page doesnt have to reload a whole page since its process is using ajax.

CascadingDropDown AjaxControlToolkit Description

Tag example:
<ajaxToolkit:CascadingDropDown ID=”CascadingDropDown1″ runat=”server” TargetControlID=”DropDownList1″
Category=”category” PromptText=”….” LoadingText=”[Loading …]”
ServiceMethod=”GetDropDownContents” />
Continue reading