Posts

Showing posts from January, 2009

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