10 May 2008

Uploading Chinese Text to MySQL database

In SQL Server, if you want to insert Chinese or other language character to a table, it was pretty simple, just specify the column type as NVARCHAR, and when you insert you can just use "N'chinese text here" but I found out that there's no such thing as NVARCHAR in MySQL database and hence this article.

To insert Chinese character:

  • Specify database character-set as UTF-8

  • Specify table or column collation set as UTF-8

  • In your web.config connection string, specify charset UTF-8
    e.g. <add name="MySqlConnString" connectionstring="server=IPAddress;userid=mysqluser;password=pa$$w0rd;database=mydb;pooling=false;charset=utf8 "/>

    This is to tell the application to use UTF-8 charset when talking to the database

07 May 2008

MCPD ASP.Net 2.0 Web Developer

In order to get my MCPD Web Developer certification, I need to take 3 exams. Each exam has a few modules under it. For more details, refer to Microsoft website.

As I said previously, I'm taking the course from New Horizons Singapore and I'm going to write about my feedback about this course and the centre that I'm taking the course from.

I've taken the 2543 and 2544 modules, the module duration was 3 and 2 days each. Before taking the course, I thought I won't get any new knowledge but I was very wrong, there was many things that we don't use as a developer but MS Visual Studio 2005 actually offers much more features than I know.

There was many new knowledge that I received from this training that can actually make myself more productive as a programmer.

About the training centre itself, the facilities are not bad. The rooms are spacious so there are enough space for each students. The PCs are good quality in terms of size, speed, etc, it's good enough to support the training process, even though my screen turned pinkish a few times. The room they used for 2544 was better than for 2543, such that the chairs are better.. the first room's chairs were kinda wobbly at first I thought I might fall off the chair, but we all just got used to it after a while.

And there was a funny experience on the first day of module 2544, there was fire drill in the building so we all have to evacuate the place. I ended up walking around Tiong Bahru plaza, but it was quite early in the morning and all the shops were not even open yet!

Overall, this is a good experience so far :)

05 May 2008

DataGrid in ASP.Net 2.0

ASP.Net 2.0 has a new control to display tabular data which is called GridView. It's supposed to be more advanced than ASP.Net 1.1's DataGrid, but I personally prefer to use DataGrid when there are data manipulation to be done on the tabular data itself.

ASP.Net 2.0 supports DataGrid for backward compatibility purposes.

The reason why I don't really like ASP.Net 2.0 GridView is because it's difficult to do updating and deleting when the DataSource of the gridview is not an SqlDataSource, but just a simple dataset that you retrieve for the database.

A few problems that I encountered:

  • When I edit a column and click Update, it didn't get the value of the template column, instead it reads the default selected value of the drop down list

  • It couldn't easily get the controls in the row being updated



Maybe I'm too used to the old DataGrid but then again, people always say "If it's not broken, thn don't fix it" so I'm sticking to the DataGrid!

Don't get me wrong, the GridView also has a lot of advantages over DataGrid, just that for my own purposes, the DataGrid serves me better :)