473,320 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

C# and SQL server problem

Dear sirs:
I'm making an application using C# and i connect through
it to a database made by MSSQL server but i have a problem
when inserting or updating in the database in arabic that
each arabic letter is replaced by a question mark (?)
the code i'm using to insert is
oleDbDataAdapter1.InsertCommand.CommandText=" sql
Statement";
and to update is:
oleDbDataAdapter1.UpdateCommand.CommandText="sql
statement";
Note:
I successeded to insert and to update in english by that
code but the problem is in arabic

Nov 16 '05 #1
3 2772
Mostafa,

Is the column you are trying to enter data into an nvarchar or nchar
column? These columns can handle unicode characters, whereas the char and
varchar are ansi characters.

Also, you have to make sure your string is prefixed with n (e.g. n"my
string") to make sure it is interpreted as a unicode string.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"mostafa atalla" <mo***********@discussions.microsoft.com> wrote in message
news:A5**********************************@microsof t.com...
Dear sirs:
I'm making an application using C# and i connect through
it to a database made by MSSQL server but i have a problem
when inserting or updating in the database in arabic that
each arabic letter is replaced by a question mark (?)
the code i'm using to insert is
oleDbDataAdapter1.InsertCommand.CommandText=" sql
Statement";
and to update is:
oleDbDataAdapter1.UpdateCommand.CommandText="sql
statement";
Note:
I successeded to insert and to update in english by that
code but the problem is in arabic


Nov 16 '05 #2
> "mostafa atalla" <mo***********@discussions.microsoft.com> wrote in
message
news:A5**********************************@microsof t.com...
Dear sirs:
I'm making an application using C# and i connect through
it to a database made by MSSQL server but i have a problem
when inserting or updating in the database in arabic that
each arabic letter is replaced by a question mark (?)
the code i'm using to insert is
oleDbDataAdapter1.InsertCommand.CommandText=" sql
Statement";
and to update is:
oleDbDataAdapter1.UpdateCommand.CommandText="sql
statement";
Note:
I successeded to insert and to update in english by that
code but the problem is in arabic


This can also be caused by your SQL Server's collation. By default, SQL
collation is SQL_Latin1_General_CP1_CI_AS, which is not Arabic. For Arabic
characters, you'll probably need to set your field's collation, or change
the database default, to SQL_Latin1_General_Cp1256_CS_AS.

For more on collation:

http://msdn.microsoft.com/library/en...ation_8f8w.asp
http://msdn.microsoft.com/library/en...ca-co_5ell.asp
Nov 16 '05 #3

"mostafa atalla" <mo***********@discussions.microsoft.com> wrote in message
news:A5**********************************@microsof t.com...
Dear sirs:
I'm making an application using C# and i connect through
it to a database made by MSSQL server but i have a problem
when inserting or updating in the database in arabic that
each arabic letter is replaced by a question mark (?)
the code i'm using to insert is
oleDbDataAdapter1.InsertCommand.CommandText=" sql
Statement";
and to update is:
oleDbDataAdapter1.UpdateCommand.CommandText="sql
statement";
Note:
I successeded to insert and to update in english by that
code but the problem is in arabic


Are you specifying the values within the sql-string
(insert into names_table (name) values ('Hans') ) ?
If so, you might need to look at parameters.
For plain english you then avoid problems with names like O'Brien.
It might work with your arabic texts as well (if the columns
accept unicode strings, see the other replies)

Hans Kesting
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
2
by: epaetz | last post by:
I'm getting Not associated with a trusted SQL Server connection errors on a .Net windows service I wrote, when it's running on my application server. It's not a problem with mixed mode...
0
by: AlessanBar | last post by:
Hello Friends !! I have a strange problem, and I need to know what would be the source of this. I have a laptop computer with the following configuration: Pentium III Brand : Toshiba Speed :...
3
by: Michael | last post by:
Dear All I have problem with my database server which running SQL server 2000. The server running very slow. The worst case, to save a record required more than 20-30 seconds. Since this...
2
by: Helge Kalnes | last post by:
We are running an ASP.NET application on a cluster of 3 web-servers, using the Network Load Balancing feature of Application Center. We have synchronized the machineKey in machine.config on the 3...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
22
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to...
1
by: sherifbk | last post by:
Problem description ============== - I have 4 clients and 1 server (SQL server) - 3 clients are Monitoring console 1 client is operation console - Monitoring console collects some data from...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.