Monday, December 10, 2007

The field is too small to accept the amount of data you attempted to add

Like the other developers, the error code print out would make easier to find out the way where we must to debug and fix the problem.

Like the error code below
System.Data.OleDb.OleDbException: The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at Register.ExecuteCommand(String MyCmd) in d:\Project\fake\UserManagement\Register.aspx.cs:line 60
The error code above represent that our Table Field Size didn't have sufficient Field Size to handle the data longer than the available Field Size.

On Ms. Access database the default length for Text Data Type is 50. The maximum length of a Text Data Type is 255. So, please provide the sufficient Field Size for the data you want to be saved on an Access database.

If the data is longer than 255 it might you need consider to use a Memo field, then you can get a whole lot more characters, but this may be overkill.

Operation must use an updateable query

It might be sometime you will got this error when working with ASP.NET and Ms. Access database.
System.Data.OleDb.OleDbException: Operation must use an updateable query. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at Register.ExecuteCommand(String MyCmd) in d:\Project\fake\UserManagement\Register.aspx.cs:line 60
The error would be different depending on your ASP.NET code. But the main error will looks similar.
This is very well known problem and may occur under the following circumstances
  • An ASP.NET worker process (Aspnet_wp.exe) runs under the default ASPNET account.
  • You do not enable impersonation on that application.
  • You try to connect to or write to an Access database.
To solve the problem you need to give the permission to ASPNET account. The exact permissions are Modify. Although on Windows Server 2003, it is probably the NETWORK SERVICE account.
  1. Right click on the folder containing the Access database, then choose Properties | Security.
  2. Click "Add".
  3. Click "Advanced" and make sure the "From this location..." entry matches the current box.
  4. Click "Find Now" and you will be presented with a list of user accounts.
  5. Double click the NETWORK SERVICE entry, then click OK.
  6. Select the "Modify" option, then click "Apply".
The image shown below illustrated the process.

Hope this helps.

Reference :

Tuesday, November 27, 2007

Don't Give Space When Calling MySQL Function

Dear people ... this might be a simple problem but you can take a whole day to trace where the problem exist if you didn't care about this. I face this problem and get confuse when working with MySQL.

I have the following code and execute well using phpMyAdmin but it's failed (no result set given) when i try to execute directly from my php script.

$strSql = "
SELECT user_password, user_name
FROM user_t
AND user_id = '" . $_POST['txt_id'] . "'
AND user_password = SHA1 ('" . $_POST['txt_pwd'] . "')" ;

if ( $objRS = mysql_query ($strSql, $objConn) )
// Do something here ...

As you can see in the bold style of the code above we can see that there is a space between MySQL SHA1 function and the parameter for that function.

After i remove that space then the problem is solved. So, my code now looks like below :

$strSql = "
SELECT user_password, user_name
FROM user_t
AND user_id = '" . $_POST['txt_id'] . "'
AND user_password = SHA1('" . $_POST['txt_pwd'] . "')" ;

if ( $objRS = mysql_query ($strSql, $objConn) )
// Do something here ...

So, keep your MySQL function closed with ( without space after function name. Hope this helps.

Wednesday, November 21, 2007

MySQL Stored Procedure : can't return a result set in the given context

This problem came when i'm deploying the program and databases to the production server while it's running smooth on my local computer. This is terrible and i have a suspicious if there's something wrong with the MyODBC Connector in the production server. I need to know what version of MyODBC Connector installed on my local computer and on my production server so i can compare it. But how do i know the version of this MyODBC Connector?

Below is my step to find out the version of MyODBC Connector :
  1. Go to Control Panel -> Administrative Tools and choose Data Sources (ODBC).
  1. Click the Add button and scroll to the end of the data source list and you will find out the version of your MyODBC Connector like shown in the image below.

The version of MyODBC Connector on my computer is while the version on production server is The MyODBC Connector version on production server come with the installation of Plesk 8.1.

This why i got the error PROCEDURE db_name.procedure_name can't return a result set in the given context when running MySQL stored procedures on the production server. And after i upgraded the MyODBC Connector to the latest version then the problem is solved.

In the general case, the server did not know if a procedure will return just one result set, or more. So, it has to assume the "worst" case, that several results sets might be returned.

Make sure we are using the latest ODBC version. And don't forget to restarting the server to takes an effect.

The support for the CLIENT_MULTI_RESULTS flag was added in 3.51.12.

How To Check If Processor Type Is 32-bit Or 64-bit

Sometime when we need to download or install a software, we need to know for what and which processor type that software. In some case we can use the same software for 32 and 64-bit version. But in most cases we need to install a different software for a specific processor type.

For a Windows user you can check the processor type using the following way :
  1. Right click My Computer and choose Properties.
  2. Click the Advanced tab.
  3. Click Environment Variables.
  4. In the System variables find a variable with the name PROCESSOR_ARCHITECTURE. If your PC has a 32-bit processor, this variable will have a value of x86. If it has a 64-bit processor this variable will have a value of x64.

This way is not a real world test for checking the processor type because
those variables can be changed by anyone but at least you can use this way.

To check the processor type for another machine or another operating system you can use this link as a reference.

MySQL Stored Procedure Is Gone !

Hello people ... i face this problem when working with MySQL Server 5.0.45

I've creating a new database on this MySQL Server and create many routines (stored procedure and function). And when i renaming the database name then all my routines related to the database i renamed is gone. All is gone.

I try to find out manually on the MySQL information schema because all the routines of all database is stored there but i find nothing except the other routines for other database. This is terrible and do not let you face the same problem.

So, be careful to backup your MySQL routines (stored procedure and function) before renaming the database name. Hope this helps !

Wednesday, September 12, 2007

GUI Editor for MySQL 5

Most of PHP/MySQL programmers will use phpMyAdmin as an administration tools when managing MySQL database. I'm one of them but i get a difficulties when working with MySQL 5 routines (stored procedure and stored function). So, i'm looking an alternate GUI for managing MySQL database.

If you have a difficulties when create/edit/drop stored procedure when working with MySQL 5 then you can try to use GUI Tools from MySQL. You can try to use MySQL GUI Tools from

The MySQL GUI Tools Bundle for 5.0 includes the following products :
  1. MySQL Administrator 1.2
  2. MySQL Query Browser 1.2
  3. MySQL Migration Toolkit 1.1
This tools is easier to use. Below is the screen shot of MySQL Administrator when working with stored procedure

How to Get Result Set from MySQL 5 Stored Procedure using Classic ASP

For developer or programmer that worked on classic ASP, if you want to communicate with MySQL 5 then you need to install MySQL Connector/ODBC from MySQL official site. The MySQL Connector/ODBC is the name for the family of MySQL ODBC drivers (previously called MyODBC drivers) that provide access to a MySQL database using the industry standard Open Database Connectivity (ODBC) API.

You need to specify the correct DRIVER on your database connection string. The source code below is an example of how classic ASP work with MySQL 5 stored procedure.

For a note :

Default PORT for MySQL is 3306. I'm here using 3307 because i'm installed 2 versions of MySQL on my computer that MySQL 4.0.26 on port 3306 and MySQL 5.0.45 on port 3307.

<%@ Language=VBScript%>

Option Explicit

Dim strConn, objConn
Dim strDBHost, strDBPort, strDBUser, strDBPassword, strDBName, blnConnStatus
Dim strSql, objRS
Dim strCustNumber, strInvNumber, strSPCode
Dim strMessage, sServer, sPort, sUser, sPassword

strDBHost = "localhost"
strDBPort = "3307"
strDBUser = "my_db_user"
strDBPassword = "my_db_password"
strDBName = "jmnsms"

strConn = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=" & strDBHost & ";PORT=" & strDBPort & ";UID=" & strDBUser & ";PWD=" & strDBPassword & ";DATABASE=" & strDBName
blnConnStatus = False

Call OpenDBConn()

Response.Write "<h3>" & strMessage & "</h3>"

If blnConnStatus = False Then


End If

strSql = "CALL jmnsms.MB_SelectInvoice();"

Set objRS = Server.CreateObject("ADODB.Recordset")

objRS.Open strSql, objConn

If objRS.EOF Then

Response.Write "Data Not Found!"


Do While NOT objRS.EOF

strCustNumber = objRS.Fields("cust_number")
strInvNumber = objRS.Fields("inv_number")
strSPCode = objRS.Fields("sp_code")

Response.Write strCustNumber & " -- " & strInvNumber & " -- " & strSPCode & "<br />"



End If

Set objRS = Nothing

Call CloseDBConn()

' Procedure to Open Database Connection
Sub OpenDBConn()

On Error Resume Next

Set objConn = Server.CreateObject("ADODB.Connection")

If Len(Err.Description) <> 0 Then

strMessage = " " & Err.Description & " MySQL connection can't be established!"


objConn.ConnectionTimeout = 120
objConn.Open strConn

If Len(Err.Description) <> 0 Then

strMessage = " " & Err.Description & " MySQL connection can't be established!"


strMessage = " MySQL connection succesfull established!"
blnConnStatus = True

End If

End If

End Sub

' Procedure to Close Database Connection
Sub CloseDBConn()

Set objConn = Nothing

End Sub


The stored procedure called MB_SelectInvoice() is look like here

CREATE DEFINER=`root`@`localhost` PROCEDURE `MB_SelectInvoice`()
SELECT * FROM jmnsms.t_invoice;

Tuesday, August 07, 2007

What an IMSI and PLMN is ?


The IMSI (International Mobile Subscriber Identity) is a unique 15-digit code used to identify an individual user on a GSM network.

The IMSI consists of three components:
  • Mobile Country Code (MCC)
  • Mobile Network Code (MNC)
  • Mobile Subscriber Identity Number (MSIN)
The IMSI is stored in the Subscriber Identity Module (SIM).


Short for Public Land Mobile Network, a generic term for a mobile wireless network that is centrally operated and administrated by an organization and uses land-based radio frequency transmitters or base stations as network hubs. PLMNs can stand alone and interconnect with one another or connect to a fixed system such as the PSTN.

Cellular phones and mobile Internet access are two common uses of a PLMN.

Friday, August 03, 2007

The log file for database is full. Back up the transaction log for the database to free up some log space.

Don't panic. This error inform that the log file for your SQL Server database is full. If you're playing with Classic ASP then the error message would be appear like this below:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]The log file for database 'YOURDATABASENAME' is full. Back up the transaction log for the database to free up some log space.

To solve this problem simply open Query Analyzer and then run the command below:

DBCC SHRINKFILE (yourdatabasename_log,0)

Then, make sure that you have a backup schedule in place to prevent the log file growth from getting out of hand. Backup the database, and then shrink the transaction log to free up log space.

You can setup a new maintenance plan. Go into Enterprise Manager -> Management, right click on Maintenance plan and choose New Maintenance plan.

Thursday, June 07, 2007

How to Check MDAC Version

There are two different ways to check which version of Microsoft Data Access Components (MDAC) is installed on your system
(1) Use the Component Checker tool.
(2) Check the version information that is stored in the registry.

Install and Use the Component Checker Tool

The most reliable way to determine which version of MDAC is installed is to compare the version number of each MDAC DLL file to a list of the DLL files that are shipped with each MDAC version. The Component Checker can help you to do this. It checks the files on the computer, compares them to a list from each version of MDAC, and reports the closest match.

To install Component Checker, follow these steps:
1. Browse to the following Microsoft Web site:
2. Click the link to download Component Checker. When you are prompted by the browser, save Cc.exe (a self-extracting executable file) to the desktop.
3. On the desktop, double-click Cc.exe; this extracts the Component Checker files and installs to the default location, C:\Comcheck.

To use Component Checker to check the MDAC version, follow these steps:
1. From the Start menu, click Run.
2. In the Open text box, type c:\comcheck\comcheck.exe and then click OK.
3. In the Component Checker - Choose Analysis Type dialog box, select Perform Analysis of your machine and automatically determine the release version, and then click OK.
4. The program attempts to identify the MDAC version on your computer by scanning all of the core MDAC files and registry settings. This process normally takes several minutes. When finished, you should receive the following message:

The MDAC version that is closest to the version on your computer is 'XXXX'.

5. Click OK.
6. A summary of the Component Checker scan appears. Note that the Dir, FileDescription, and FileSize errors can be safely ignored.

Check the Version Information Stored in the Registry

Because now Microsoft using a system to check whether you are using Windows Genuine Version or not like the image above, then if you're unable to get the Component Checker tool you can check the MDAC version in the registry. The version information is found in the following key: HKEY_LOCAL_MACHINE\Software\Microsoft\DataAccess\FullInstallVer

To check the registry, follow these steps:
1. On the Start menu, click Run.
2. In the Open text box, type regedit and then click OK; this starts Registry Editor.
3. In the Navigation pane, drill-down to the following path: HKEY_LOCAL_MACHINE\Software\Microsoft\DataAccess
4. In the Details pane, look in the Name column for FullInstallVer and Version. Each of these keys will have corresponding version information in the Data column.
5. When finished, click Exit on the Registry menu to close Registry Editor.

An example is shown in the image below

Reference :

Thursday, May 17, 2007

Microsoft VBScript runtime error '800a000d' Type mismatch: 'objRegExp.Replace'

As you can see, the article title describes the error of VBScript runtime. Yes, that's right. This is the runtime error when i'm using classic ASP RegEx function. So, why we get this error ?

Microsoft VBScript runtime error '800a000d'
Type mismatch: 'objRegExp.Replace'

Don't worry, not all error is caused by our mistake on programming code. Sometimes the mistake are come from the NULL value from the database. So, you need to make sure that the value returned from the database is NOT NULL.

Below is the sample of classic ASP RegEx code :

Function stripHTML(strHTML)

'Strips the HTML tags from strHTML
Dim objRegExp, strOutput

'Ensure that strHTML contains something
If Len(strHTML) = 0 Then
stripHTML = strHTML
Exit Function
End If

Set objRegExp = New Regexp

objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<(.|\n)+?>"

'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, " ")

'Replace all <> with < and >
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, ">", ">")

stripHTML = strOutput 'Return the value of strOutput

Set objRegExp = Nothing

End Function

Friday, April 13, 2007

Patching gnokii 0.6.14 for iTegno 3000 GSM Modem

Hi all. At this time i will share my experience on patching gnokii 0.6.14. Why we need to do a patch for gnokii 0.6.14 ?
Well, somebody are using iTegno 3000 GSM Modem or a device that known as a WAVECOM MODEM. And without using this patch then probably your smsd daemon won't work as expected. So, you still need this patch to make your AT Command working as you expected.

Simply editing file atgen.c (this file located at gnokii-0.6.14\common\phones\atgen.c)

Go to line 563 of your atgen.c file and you will find a code like this image below

Replace that code with the text like this image below

Go to line 1442 of your atgen.c file and you will find a code like this image below

Replace that code with the text like this image below

And all are already done. Please re-install your gnokii installation from the beginning with this new patch. Hope this article helps. Please read my another blog article about gnokii and iTegno 3000 GSM Modem on this site. It might help you too.

Saturday, April 07, 2007

Credit Card Verification

There are two verification system for the credit card. That is AVS and CVM.

1. AVS

AVS stands for Address Verification System. AVS is only available for the U.S. and partially available in four European countries. In the US, AVS checks if the cardholder's address and zip code matches the information at the card-issuing bank. AVS only uses the zip code and numeric portion of the billing street address. There are many reasons why AVS may fail (recent address change, AVS computers down, etc.). If the address verification fails on any level, the merchant may decline the transaction. If the AVS fails for any reason, the merchant should contact the customer for additional information (for example, the name of the issuing bank, the bank's toll-free telephone number, etc.).

The code will tell you whether or not the address given in the order actually matches that of the cardholder. On some system, the AVS code is comprised of three numbers. The first corresponds to the numbers in the street address. The second corresponds to the zip code. And the third is an overall verification of both. For example, an AVS code of YYY means: "yes" the address matches, "yes" the zip code matches and "yes," both the address and zip code match the cardholder's. But an AVS response code of NYZ means "no" the address does not match, "yes" the zip code matches and only the "zip" code matches.

Don't be fooled by YYY response codes. Some crooks have access to the cardholder's address information. Be observant and know what red flags to look for. Pay close attention to: the product ordered and order size; the e-mail address given; the ship-to address and shipping method requested among other things. Be suspicious of sizeable purchases that are being shipped to a different address, especially if express shipping is requested. Pay attention to whether or not the e-mail address given is valid. If the e-mail address is a person's name, check to see if it matches the cardholder's name. These, among other things, are all red flags to look for.

Below is the common AVS response code letters and their meanings :
Letter_ Meaning
Y_____ Exact Match
N_____ Not A Match
A_____ Address Match Only
Z_____ Zip Code Match Only
S_____ Service Not Supported (often for non-US credit cards, get proof from cardholder via fax if possible)
U_____ Address Information Not Available (call cardholder's issuing bank)
X_____ When with "YY" means exact match. Otherwise, "XXU" means address Information Not Available (call cardholder's issuing bank)
R_____ Retry - System Unavailable Or Timed Out
W_____ Zip Code OK
E_____ Error Response For Merchant Service Category Code

2. CVM

CVM stands for Card Verification Methods (VISA = CVV2, MasterCard = CVC2, and American Express = CID use a security code of 3 or 4 extra digits imprinted on the card, but not embedded or encrypted in the magnetic stripe. This verification code does not appear on credit card receipts. Since most fraudulent transactions result from stolen card numbers rather than the actual theft of the card, a customer that supplies this number is much more likely to be in possession of the credit card. VISA claims that the use of AVS with CVV2 validation for card-not-present transactions can reduce chargebacks by as much as 26%.

Tuesday, April 03, 2007

How To Find The Service Pack Version Installed On SQL Server

To determine the service pack that's installed on your SQL Server, open Query Analyzer. Connect to your server. Execute the following command:


The output of this command will be something like the one pasted below. The first line of the output displays the version number of the server. The last 3 digits (build number) of the version number are used to determine the service pack installed on your SQL Server. In this case 194.

Microsoft SQL Server 2000 - 8.00.194 (Intel X86)
Aug 6 2000 00:57:48
Copyright (c) 1988-2000 Microsoft Corporation
Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 2)

Below are the SQL Server version list :

SP Version : 6.00.121
Product___ : SQL Server 6.0

SP Version : 6.00.124
Product___ : SQL Server 6.0

SP Version : 6.00.139
Product___ : SQL Server 6.0

SP Version : 6.00.151
Product___ : SQL Server 6.0

SP Version : 6.50.201
Product___ : SQL Server 6.5 (Hydra)

SP Version : 6.50.213
Product___ : SQL Server 6.5 (Hydra)

SP Version : 6.50.240
Product___ : SQL Server 6.5 (Hydra)

SP Version : 6.50.258
Product___ : SQL Server 6.5 (Hydra)

SP Version : 6.50.281
Product___ : SQL Server 6.5 (Hydra)

SP Version : 6.50.415
Product___ : SQL Server 6.5 (Hydra)

SP Version : 6.50.416
Product___ : SQL Server 6.5 (Hydra)

SP Version : 7.00.623
Product___ : SQL Server 7.0 (Sphinx)

SP Version : 7.00.699
Product___ : SQL Server 7.0 (Sphinx)

SP Version : 7.00.842
Product___ : SQL Server 7.0 (Sphinx)

SP Version : 7.00.961
Product___ : SQL Server 7.0 (Sphinx)

SP Version : 7.00.1063
Product___ : SQL Server 7.0 (Sphinx)

SP Version : 8.00.194
Product___ : SQL Server 2000 (Shiloh)

SP Version : 8.00.384
Product___ : SQL Server 2000 (Shiloh)

SP Version : 8.00.534
Product___ : SQL Server 2000 (Shiloh)

SP Version : 8.00.760
Product___ : SQL Server 2000 (Shiloh)

SP Version : 8.00.2039
Product___ : SQL Server 2000 (Shiloh)

SP Version : 9.00.1399.06
Product___ : SQL Server 2005 (Yukon)

Apart from SELECT @@VERSION, there are other commands too, that show you the build number. Try, sp_server_info and master..xp_msver. In SQL Server 2000, there is a new system function called SERVERPROPERTY, that returns service pack information. Here is an example:


Changing SQL Server Passwords

Most security experts recommendations include changing passwords frequently to enhance security. It is easy to change the password on a SQL Server Username via Query Analyzer. Changing the password with Query Analyzer makes it easy to coordinate changing the password on the database server at the same time as it is changed in the connection string. This approach provides the flexibility to change the password at the most appropriate time for the application.

To change the SQL Server Username password, just connect to the database with Query Analyzer using the SQL Server Username that is being updated and the current password. Then run "sp_password" to change the password.

Here is a simple example that changes the current password from "current_password" to "new_password" :

sp_password 'current_password', 'new_password'

If your first SQL Server installation use a blank password then you need this way to change the SQL Server password :

sp_password NULL, 'new_password'

Be sure to use a strong password, "new_password" is just an example. For a quick test to confirm that the new password is working, close Query Analyzer and then re-connect with the new password. That is all there is to it, except for changing your connections string. It is obvious, but still critical to remember to change the password in your connection string if this SQL Username is used in your code. Once the password has been changed and tested with Query Analyzer, update the connection string with the new password and test that everything still works correctly, and you're done.

Thursday, March 22, 2007

Using Server.HTMLEncode on Classic ASP

If you have an ASP pages that display strings stored in the database fields, you should always process the strings with the Server.HTMLEncode method, otherwise the string won't be displayed correctly in the user's browser if it contains characters that have a special meaning to HTML, such as the quote ("), the less-than (<) and greater-than (>) symbols, the ampersand symbol (&), and any character whose ANSI code is larger than 127.

It is easy to hardcode these things into our ASP script, but if these characters exist in your database, you need to dynamically encode them. To do so, apply the HTMLEncode method to your recordset data before it is sent to the response object:

Response.Write Server.HTMLEncode(rs.Fields("my_field"))

Other examples is:

Dim sLink

sLink = "<a href="''">Printers Post Australia</a>"

Response.Write "Not HTMLEncoded string: " & sLink & "<br/><br/>"
Response.Write "HTMLEncoded string:" & Server.HTMLEncode(sLink)


Monday, March 19, 2007

DKU-5 vs CA-42 Data Cable

Hello all, now i want to explain the differences between Nokia DKU-5 and CA-42 data cable. Sometime we are confusing to choose a data cable for our Nokia Phone. There are DKU-5 and CA-42 data cable. I hope this article helping you who are decided to buy a Nokia data cable.


DKU-5 has a chip in it to emulate a serial port through the USB connector. This is for phones without native USB connectivity. DKU-5 is used for models without external memory (6100, 3100, 3120, 3200, 3220, 6610, 7210, 7250, 68xx, 6200, 6220).


CA-42 is a replacement cable for DKU-5 cable. Some phones are compatible with both of them, some with just CA-42.

The main differences are three :
  1. The CA-42 cable consumes less power than the DKU-5 when it is idle.
  2. The CA-42 cable is not detected by the PC unless the phone is connected to the other end.
  3. The CA-42 cable can be also used in Operating Systems other than Windows 98/2K/XP, such as Windows CE, Linux and Mac.

Thursday, March 15, 2007


When we are developing a website using ASP script, sometime we had to format dates, numbers, currency, etc. by ourself. And relying on the version of Windows that was installed on the server, it is not good idea in case you moved sites from say The United States to a United Kingdom provider. With IIS4 and IIS5 (Windows NT4 and Windows 2000 respectively) you only need to set the LOCALE ID (Session.LCID) and everything is done for you. The Session.LCID is a read/write property, meaning you can assign a value to it as well as read its current value.

Session.LCID has session scope, which means you can just add one line of code to your global.asa file and ASP does the rest for you. Just remember that if you assign a new value to the Session.LCID it will override global.asa and will remain until a new value is set or the session is ended.

Below you can see locale id's for the US and the UK as well as how dates are formatted using these locales.

Session.LCID = 1033 'This is the English(United States) format.

Short Date : 3/15/2007
Long Date : Thursday, March 15, 2007
Time : 12:11:02 AM
Currency : $9.95

Session.LCID = 2057 'This is the English(British) format

Short Date : 15/03/2007
Long Date : 15 March 2007
Time : 00:11:02
Currency : Ј10.00

When working with databases, you will want to also set the format of the date field to correspond with the LCID that is being used in the script. You can do this by going into the design view and setting the format to dd/mm/yyyy or the format you are using.

Below is a table of the LCIDs, and the corresponding language that you have available:


1025____Arabic(Saudi Arabia)
3076____Chinese(Hong Kong)
5129____English(New Zealand)
7177____English(South Africa)
1033____English(United States)
5130____Spanish(Costa Rica)
7178____Spanish(Dominican Republic)
17418___Spanish(El Salvador)
20490___Spanish(Puerto Rico)
3082____Spanish,Spain-Modern Sort
1034____Spanish(Spain - Traditional Sort)