Thursday, January 31, 2008

Excel in a .NET Application

It has been a really hard work week after too many hours of coding. Thankfully I can get a whole week rest after tomorrow.Last week, after a meeting with my project manager and my users, I had been assigned to build an application which includes import/export data from/to an excel spreadsheet functionality.VS .NET allows us to add Excel reference. Once Excel reference is added into an application, you can take control of every aspect of Excel by using a rich library of objects provided by Excel itself, e.g. add formatting, additional...

Tuesday, January 29, 2008

ASP .NET DataGrid with fixed headers

When dealing with data grid in ASP .NET, a very common design request for it is having a data grid which has a horizontal scrollbar and fixed column header.Adding a ScrollbarA vertical scrollbar is very useful when your data grid contains of many rows that cannot fit into a web page. This can be done by using DIV tag. Enclose your data grid into a <div> tag and set the overflow style to scroll or auto. Look at the example as below:<DIV id=”div-datagrid” style=”OVERFLOW: auto;”>    <asp:datagrid...

Monday, January 21, 2008

DoCmd.HourGlass Method in MS Access

In MS Access, when a macro action takes a long time to run, you can use DoCmd.HourGlass to change your mouse pointer to an image of an hourglass or any icon that you like, by using the code as below:DoCmd.HourGlass TrueorDoCmd.HourGlass FalseIt has the following argument: True/False, or 0/...

Saturday, January 19, 2008

Export Data to Excel (Not HTML Tables)

Recently I working with export data to an excel file, but had faced a lot of problems. The main problem of it: The exported file is saved as HTML tables with XLS extension, not the actual XLS format. In this way, I can’t re-import the data using the OleDbConnection.I have been searching around the net, but no exact solution that suit my situation. Finally, I had found another way to export data into the actual XLS format, by using Excel.Application.First thing that you need to do is to add Excel dll (Microsoft Excel 11.0 Object...

Wednesday, January 16, 2008

Simple error log files in ASP .NET

In some circumstances, you may not be able to debug your web application to determine what exception had occurred in it. So to create an error log file is very important to keep track of the occurred exception.In this post, I will show you how to write an error log files by using a class file (.cs).First of all, a class called CreateLogFiles needs to be created. In this class file, add in the codes as following:using System;using System.IO;using System.Text;namespace CSharpWeb{     public class CreateLogFiles...

Tuesday, January 15, 2008

Can I use .NET Framework 2.0 from VS .NET 2003?

Currently I am working with VS .NET 2003 with .NET framework 1.1. But recently I found out that some features that only available in .NET framework 2.0 is needed in my project. I had downloaded the .NET framework 2.0 package and think of want to use it within the VS .NET IDE. Problem arose. I do not know how I can achieve to it. And after a few searches on net, I found out that each release of Visual Studio is only tied to a specific version of the .NET framework. I found the following comment on the VS 2005 Express FAQ:Can...

Sunday, January 13, 2008

Sending mail in ASP .NET

Sending e-mails from a website is very common nowadays, especially while registering on a website, an automated e-mail will be sent to your mailbox for verification and confirmation purpose.ASP .NET simplified the work of developers with the introduction of a namespace called System.Web.Mail. By using this namespace, developers can easily sending a plain text mail, HTML mail, or sending attachments.Sending Plain Text...

Thursday, January 10, 2008

SQL Server function for datetime - DATEADD

DATEADD is a date function that will return a datetime value based on the number interval add to the particular date part of the specified date. Here is the syntax for DATEADD:DATEADD(date_part, number_interval, specified_date)date_part is the parameter that specifies on which part of the date to be manipulated with the number interval. You can add month, year, day and etc. You can useMONTH, MM or M for monthYEAR, YYYY, YY for yearDAY, DD, D for dayHH for hourSS, S for SecondFor example :SELECT DATEADD(D, -1, GETDATE())AS [Yesterday]SELECT...

Monday, January 7, 2008

How to use the LIKE clause in SQL Query in MS Access

This article will show you how to use the LIKE clause in SQL to search all the related records in a table that begin with, end with or contain a certain letter.Normally for LIKE statement, the wildcard character is “%”, but please take note that, in MS Access, you have to use the wildcard “*” instead of “%”, else it is not working.Here are some examples using the LIKE clause:LIKE [First character that you want to search] & “*”LIKE “*” & [Certain character that you want to search] & ...

Thursday, January 3, 2008

Stored Procedures in MySQL 5.0

Some people resisted to use MySQL because it had no support for stored procedures. But with MySQL 5.0, it has its new functionality for Stored Procedures. What are stored procedures actually? They are collections of SQL query and procedures that stored and run on the database server.Before MySQL provides this new feature, MySQL developers need to store their procedures on the application, there hasn’t been an option anyway. And now, this new feature is available on version 5.0, and I am going to discuss why we would want to...

Wednesday, January 2, 2008

Page.RegisterHiddenField Method

This article explains the Page.RegisterHiddenField Method.From MSDN library’s explanation, Page.RegisterHiddenField method allows server controls to automatically register a hidden field on the form. The field will be sent to the page when the HTML Form servers control is rendered.This method takes 2 parameters:hiddenFieldName – The unique name of the hidden field to be renderedhiddenFieldInitialValue – The value to be emitted in the hidden formPlease take note that if you use this method twice with the same id with different...
 

Get paid for your opinions! Click on the banner above to join Planet Pulse. Its totally free to sign up, and you can earn UNLIMITED. Find out more by visiting PLANET PULSE.
Sign up for PayPal and start accepting credit card payments instantly. http://www.emailcashpro.com
July Code Blog Copyright © 2010 Blogger Template Designed by Bie Blogger Template