Monthly Archives: October 2012

Asp.Net Ajax Client Network Calls Techniques With WebRequest & WebRequestManager

Ajax Network Calls is almost being most extensively used on web application. Client calls a page on Url via javascript and the Url’s content is being stored in a variable as a string.
This variable can be written on html element like div element. Traditional ajax is basically a network call.

We can use ajax network call technique to populate combo box or select element from database, Auto complete function, search records, update, insert record etc.

I’ll give examples of ajax network calls techniques using client script Sys.Net.WebRequest class. We will use this client side class in javascript.
Remember that we have to put ScriptManager control in aspx page to enable Asp.Net ajax extension.

Web Request Example

I have two textboxes which their ids are txname and txage. After user enters his/her name, age and clicks “Go” button, current date and time will be displayed in div element along with entered values in each textboxes.

Continue reading

Handling Large MySQL Result Set Part 1 (Some experiments)

Big or Medium Application may have large MySQL data. Large data means millions of records.

How can we handle very large data in MySQL? Many methods can be found on internet but until I write this post I cannot find any generic answer for all situations / requirements except using common ‘Limit’ clause.

So I do a little research on my own and I want to share it here.

I use MySQL.exe command prompt instead of PHPMyAdmin due to MySQL.exe is a core engine so then it is more objective. I use Windows OS, CPU Core 2 Duo and 2 GB RAMs.
My MySQL server version is 5.5.8 Community Server (GPL).

I use MySQL Employee sample database, please follow this link: http://dev.mysql.com/doc/employee/en/index.html to get it.

Employee sample database has tables with large records i.e employee table has 300,024 rows, titles has 443,308 rows, salaries has 2,844,047 rows.
Continue reading

SSRS 2008 R2 Programmatically List Running Reports/Jobs & Cancel Examples

SSRS 2008 R2 does not have pre built List Running Reports in Web format that comes from installation. Unlike the older version: SSRS 2005, we have to use SQL Server Management Studio (SSMS) to see SSRS 2008 R2 running reports / jobs .

The lack of this pre built web format is kind of missing in my day to day monitoring because of SSRS 2008 R2 List running jobs view in SSMS shows only the report name in the first look.
I have to look at each jobs properties to see more details which means more clicks are required.

The below screen shot shows the older version: SSRS 2005 list running Reports:

Steps to show SSRS 2008 R2 list running Reports with help of SSMS are:

  1. Open SSMS 2008 and connect to Reporting Service server.
    Set Server Type field to Reporting Service. Server Name set to Url http://<myserveripaddress>/reportserver. Replace the <myserveripaddress> to your report server ip address.
    Authentication, UserName and Passwd depend to your environment. If your localhost is Reporting Service server then you can use Window Auth.
    Otherwise if the server is a remote server then use basic/form auth. Anyway just try it.
  2. Open Jobs folder to see running Reports. Refresh it to see current jobs.
  3. Double click to see more details at each job
  4. Cancel Job(s) by right click job and click ‘Cancel Job(s)’

Alternatively, we can build our own list running reports/jobs tool. SSRS has a built in class to show running Reports programmatically. The class is ReportingService2010 for SSRS 2008 R2. This class is accessed via web service. The Url path of this webservice is http://<myserveripaddress>/ReportServer/ReportService2010.asmx.
In this blog post, I give you examples of programmatic SSRS 2008 R2 List running jobs.
Continue reading

How to Show Data from Any Source such as Array, DataTable, WebService and Database Using Asp.Net ListView and ObjectDataSource

A web page is about to show a data. This data may generate from database or other object like an class instance.

Mostly, data is presented to a table and a lot of tutorial about making a table that I have is related to database. Developers have a listview / gridview / repeater etc for data view and sqldatasource control as a data source.

Although sqldatasource is good and may increase productivity. An organisation is not always use SQL Server and one of their web tables may not use database at all.

So I prefer to use ObjectDataSource control. This control is more generic data source because we use our own bare class to return a DataTable instance. Since we write our own class then inside it we can code an operation to any RDBMS or work with any objects.
ObjectDataSource control is also good option to retrieve data via Web Service from another Server and maybe that Server is located at different site. We cant see any code like database connection in Web Service but only class and namespace reference of it. Although maybe there is a database operation inside Web Service itself.

In this blog post, I generate the data manualy to DataTable in the first example and secondly, I generate it from webservice and database. Both of them show data via listview and use arbitrary class that I make. ObjectDatasource acts as bridge between this custom class instance and listview.

Adding Data Manualy to DataTable

Here’s the example:
I will show simple table that has persons info with their name, city and province.
.aspx file (piece of code):


    <div>
        
        
            <table>
            <thead>
                <tr>
                    <th>Name</th>
                    <th>City</th>
                    <th>Province</th>
                </tr>
            </thead>
             
            </table>    
        
        
            
            <tr>
            <td></td><td></td>
            <td></td>
            </tr>
        
       
         
        
    </div>
    

Continue reading