943,926 Members | Top Members by Rank

Ad:
  • MS SQL Discussion Thread
  • Marked Solved
  • Views: 8190
  • MS SQL RSS
Nov 3rd, 2008
0

Can't insert special characters to SQL

Expand Post »
Hi Everyone!

I have to make a forum with MS SQL, and, as I'm Hungarian, we use characters, like áéíőúű, etc. Now, if I insert a text with the letter ő or ű, I get back o and u. How can I solve this problem?

The users write posts in an aspx website, by a textbox. I use this code in the insertcommand:
sql Syntax (Toggle Plain Text)
  1. @"INSERT INTO Forum2 (Sorszám, Idő, Feladó, Üzenet) VALUES (" + GridView1.Rows.Count + ", '" + DATETIME.NOW + "', '" + namebox.TEXT.ToString() + "', '" + @message.TEXT.ToString() + "')";

Oh, and is there any way to count an SQL database's rows? That way, I could allow paging..

Thank you!
Last edited by peter_budo; Nov 5th, 2008 at 9:25 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
konczuras is offline Offline
59 posts
since Oct 2008
Nov 3rd, 2008
0

Re: Can't insert special characters to SQL

row count is easy, just use
MS SQL Syntax (Toggle Plain Text)
  1. SELECT count(*) FROM TABLE

what is the character set of the db?
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Nov 6th, 2008
0

Re: Can't insert special characters to SQL

1,You must set the table field which use unicode characters with nvarchar type.

2,In dot net program environment , save the page as utf-8.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
canonzone is offline Offline
5 posts
since Oct 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS SQL Forum Timeline: Insert_Update Stored Procedure and returning Identity
Next Thread in MS SQL Forum Timeline: convertion..





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC