Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need to save UniCode characters to SQLdb- How is this done?

Posted on 2001-06-28
8
Medium Priority
?
241 Views
Last Modified: 2006-11-17
I have a password field that gets encrypted characters. In SQL server the field is an nvarchar an it should accept any character, however it does not. Speaking with Nigel in the SQL expert area he has stated;

"What is the field supposed to hold - you only need ntext if the field needs to be more than 4000 chars.
text fields are a lot more difficult to manipulate than chars so should only be used if necessary.The nvarchar field will accept any unicode character - if it is not then there is probably a problem with your interface. The field needs to be handled as unicode everywhere."

I believe he is on to the answer, but i'm not sure I'm sending unicode to the db or more likely the case I'm not accepting them back. How do I save and retrieve Unicode characters (strings) and why is this a problem?

0
Comment
Question by:rblackwell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 5

Expert Comment

by:raizon
ID: 6235383
I'm not sure if this will work but you can try setting the enctype in the form element (enctype="multipart/form-data").  That is what is required to send non-ascii data via a form.

HTH

Raizon
0
 
LVL 15

Accepted Solution

by:
robbert earned 600 total points
ID: 6235541
This works:

INSERT INTO table (nvarchar-field)
VALUES (N'unicode-string')

However, I didn't find a way to make:

objRst.AddNew
objRst("nvarchar-field") = "unicode-string"
objRst.Update

to work, trying variations.

HTH
0
 

Expert Comment

by:globarena
ID: 6237348
hi rblackwell,

Try with  this:


<META http-equiv=Content-Type content="text/html; charset=unicode">

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 20

Expert Comment

by:Michel Sakr
ID: 6237471
the form should be unicode and the script code page should be set to your character set:

ussian code page:

<%@ Language=VBScript Codepage=1251%>

or

Session.CodePage=1251

(Session.LCID = 1251  'location identifier, used for currency,date etc formats)


these code page links might help:

http://www.microsoft.com/globaldev/reference/WinCP.asp
http://www.microsoft.com/globaldev/win2k/setup/localsupport.asp
http://www.microsoft.com/globaldev/FAQs/Locales.asp
0
 

Author Comment

by:rblackwell
ID: 6239477
Roberts idea to use "INSERT INTO table (nvarchar-field)
VALUES (N'unicode-string')" seems to be in line with our coding requirments.
The result however is this ->
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'wyi'.
My SQL statement passed to ADO is this ->
SQL=UPDATE Customers SET PassWord = N 'wyi' WHERE Username = 'rblackwell'

The part 'wyi' is the encoded password with non-ascii chars. Why does it not like the SQL statment???
0
 
LVL 15

Expert Comment

by:robbert
ID: 6239508
I must admit that the N' (and the codepage) thing is all I know. Also, I grabbed my suggestion from somewhere, and it just worked with ASCII characters, and nXX fields in SQL Server (that's a first achievement as nXX fields can't be addressed, otherwise).
Sorry.
0
 

Author Comment

by:rblackwell
ID: 6239520
There was an extra space after the N - now it works.
Thanks Once Again to my man Robert!
0
 
LVL 15

Expert Comment

by:robbert
ID: 6239648
At least, it works somehow :-)
And thanks, I just posted because you're such a "good" questioner.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question