Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unicode characters showing as ?

Status
Not open for further replies.

lidds

Programmer
Jun 9, 2005
72
GB
I have developed an application and need to allow users to enter text in any language and save it to my database. However the text is saved as '?' in my database. I have googled quite a bit and found that people have suggested not to use varchar, text types but use nvarchar and ntext etc in your database. I have gone through and made these changes to my database.

However it still saved text as '?', I then found people where saying about adding 'N' infront of the text prior to saving into the database. The problem is that I cannot figure out how to do this in a stored procedure.

Stored Procedure
Code:
CREATE PROCEDURE [dbo].[spUpdateActionTaken] @ID as varChar(4),@action as text,@modifyDate as varchar(50)

AS

UPDATE commentsTbl SET commActionTaken=@action,modifyDate=@modifyDate WHERE [ID]=@ID
[code]

Note: Fields commActionTaken set to nText

[b]VB.Net Code[/b]
[code]
Dim actionTaken as String = Me.textBox.Text
Dim myCmd As New OleDb.OleDbCommand("spUpdateActionTaken")
myCmd.CommandType = CommandType.StoredProcedure
myCmd.Parameters.Add(New OleDb.OleDbParameter("@ID", OleDb.OleDbType.VarChar)).Value = ID
myCmd.Parameters.Add(New OleDb.OleDbParameter("@action", OleDb.OleDbType.VarChar)).Value = actionTaken
myCmd.Parameters.Add(New OleDb.OleDbParameter("@modifyDate", OleDb.OleDbType.Date)).Value = Now()

I am assuming that this is the solution or do I have to change anything else in the database? I am using MS SQL 2000 database.

Thanks in advance

Simon

 

To add the N at the front of the text:

myCmd.Parameters.Add(New OleDb.OleDbParameter("@action", OleDb.OleDbType.VarChar)).Value = [red]"N" & [/red]actionTaken

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top