"Your database cannot support the language that my web
page is written in."
In some rare cases, it is due to some settings in the SQL server. But in
most cases, it is not.
The basic concept is that a database is a .... database. It simply
stores DATA. Whatever data has been fed into it, it will return you the
same data. (This is a very general picture. There are some conversions
going on when you store and retrieve data in a MSSQL server, but these
conversions do not affect us in most circumstances. Also, if you
specified a field as a particular data type, for example,
int, the SQL server naturally
will expect an integer for that field. If you try to key in something
else, it can either reject the data, or try some conversion on its own.
And when it does any conversion, the results are usually not quite what
we expect.)
Let's take for example, a particular Oriental language character
.
Your script needs to display this character. Your script expects to see
the data string
効 in order
to display
.
Your script pulls the data from the database. Thus, when you enter the
data into the database, you should enter the data as
効 . (Note:
This is just an example. It does not cover everything about displaying
different languages using data pulled from a database. And there are
many ways of doing it. This article only gives a very brief,
over-simplified picture, for clarity sake. The data needed to display
Oriental language characters often cannot be represented by characters
you see in the keyboard.)
One important point: many different language characters cannot be stored
in a field that uses char or
varchar as data type. It is better to use
data types like nchar or
nvarchar.
You can try out this experiment. In this experiment,
you'll create a simple table in your database. You'll then use a ASP.NET
script to enter and to retrieve some Japanese characters.
Create a simple table for this experiment.
CREATE TABLE testtable1
(Name NVARCHAR(100),
Address VARCHAR(100)
)
Add in a test record.
INSERT INTO testtable1 values ('my
name','my address')
Download this file, extract it.
It should extract into a file named "datagrid5.aspx".
Edit lines 11 and 12 so that the script can connect to
your database.
Upload the script into your web site, and run the script
by going to, for example,
http://www.my-domain-name/datagrid5.aspx.
Copy the Japanese characters here 適応できるかは .
(Note: If you cannot see the Japanese characters, this means that your
computer is not installed with the necessary language packs.) Go to the
"datagrid5.aspx" script in your site, for example
http://www.my-domain-name/datagrid5.aspx, and paste the Japanese
characters into the "Name" box like this...

... then click "Add Author".
After you click "Add Author", the Japanese characters
will be inserted into the table you just created above. At the same
time, the script will do a query display all the records in the table.
The final result will look something like this...
(Please click on thumbnail to enlarge image.)
What does this experiment show? It shows that the ability
of databases to store different languages usually does not depend on the
setting of the database itself. It depends on how the data is entered,
and the how the data is being queried from the database.
|