Posts

Showing posts from 2009

ASP.NET CustomValidator - Changing error message at client side

The ASP.NET CustomValidator server control is very useful because it allows me to write my own validation logic with a few tweak to the settings and a few lines of codes. Not only it will provide server side validation, but it's able to do client-side validation as well. Furhter information about this can be found on MSDN website. The only problem that I have, is that I was not able to change the error message based on validation rules that I set at the client-side validation script. I tried to search on the Internet, and all I came across are either setting the source.errormessage, or the source.innerText attributes. Yet, none of them work for me, and I can't even find anything on MSDN that mentioned about this. So, applying some 'investigating' mind here, I tried to check what will CustomValidator be represented with, and it's represented by a <span> tag. Then, I tried to see if there's any value that I could retrieve in the client-side script by wr

SQL - SELECT withi a SELECT

I was trying to re-write some of the stored procedures for one of my office project the other day to exclude certain unwanted entries. It was done in such a manner. SELECT * FROM [table_A] LEFT JOIN [table_B] ON [table_A].column_id = [table_B].column_id WHERE [table_A].column_c NOT IN ( SELECT [table_A].column_c FROM [table_A] WHERE [table_A].column_c LIKE '%something' OR [table_A].column_c LIKE '%somethingC' OR [table_A].column_c IN ('value_A', 'value_B', 'value_C') ) I tested it in the SQL 2005 Manager Console, and it works fine. I tried it out as well on the actual website, and it does work as well. However, it did a significant drawback that I was not able to notice. This statement will not return anything, or throwing an exception saying "Timeout operation" when it was trying to return a large number of rows. I can't figure out why it doesn't work

MySQL - How in the world I check the NULL value of this guy?

I was trying to work on extracting information out from MySQL via ASP.NET. Since MySQL only provides the connector, and I can't really connect to MySQL from ASP.NET via simple configuration steps on the ASP.NET web form or web.config, I have to write my own class to do the job. As it progressed, I found that MySQL behaves differently as compare to SQL Server in terms of handling NULL value. I could simply do a NULL checking on data return from SQL Server with the following syntax. value = (data_table[column_name] == NULL ? NULL : data_table[column_name]); So, since MySQL has provided us with a .NET connector, I would assume that the above would work as well; but sadly, it doesn't. Oh Dear, what has gone wrong with it? When I tried to debug the web form (yes, debugging a web form is possible in Visual Studio 2005), I found out that the NULL value is returned with '{}'. This is not NULL!!! So how should I do this? I was totally mad about this because if the syn