473,948 Members | 17,062 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
oleDbDataAdapte r1.InsertComman d.CommandText=" sql
Statement";
and to update is:
oleDbDataAdapte r1.UpdateComman d.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 2799
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.co m

"mostafa atalla" <mo***********@ discussions.mic rosoft.com> wrote in message
news:A5******** *************** ***********@mic rosoft.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
oleDbDataAdapte r1.InsertComman d.CommandText=" sql
Statement";
and to update is:
oleDbDataAdapte r1.UpdateComman d.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.mic rosoft.com> wrote in
message
news:A5******** *************** ***********@mic rosoft.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
oleDbDataAdapte r1.InsertComman d.CommandText=" sql
Statement";
and to update is:
oleDbDataAdapte r1.UpdateComman d.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_Gene ral_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_Gene ral_Cp1256_CS_A S.

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.mic rosoft.com> wrote in message
news:A5******** *************** ***********@mic rosoft.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
oleDbDataAdapte r1.InsertComman d.CommandText=" sql
Statement";
and to update is:
oleDbDataAdapte r1.UpdateComman d.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
6807
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 the SQL Profile to watch the T-SQL-Command which Access ( who creates the commands?) creates and noticed:
2
2585
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 security. I'm set for mixed mode and I've been running the service on the app server for over a month with no problem. My database is running on a second server and both are under the same domain. The problem has occurred twice over the last two months.
0
4143
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 : 500 Mhz RAM : 192 MB Hard Disk : 6 GB
3
12894
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 problem, I usually monitoring Process Info from Enterprise Manager (Management - Current Activity), and I found a misterious process as follow : 1. User : System
2
3439
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 web-servers, so we can utilize a random algorithm for server selection for requests. The application does not use either session state or application state. We recently upgraded to .NET Framework 1.1 (including the hotfix for the "doPostback...
2
3202
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 problems that I have encountered to date and the solutions (if any) that I found. http://users.adelphia.net/~brianpclab/ServerControlCollectionIssues.htm This page also has all of the source code in a compressed file that you are free to download...
6
3821
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 one day): \\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During Execution: 7 \\FFDS24\ASP.NET Apps v1.1.4322(_LM_W3SVC_1_Root_ATV2004)\Compilations
22
3327
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 load DLL (aspnet_isapi.dll)." Of course the dll is able to be found, it's still in the framework directory and for grins I even put it in my service's local directory. This is apparantly server 2003 not allowing asp.net to be run if IIS was not...
1
5141
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 the control unit and store them into the Sql server - The operation console then retrieve this data from the sql for reporting and statistics purposes - I am using ODBC connection - The problem is that the operation console is not able to...
39
5906
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 ISO-8859-1 -t UTF-8 mydb.sql mydb_utf8.sql mysqlCREATE DATABASE mydb_utf8 CHARACTER SET utf8 COLLATE utf8_general_ci;
0
10165
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
11580
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11179
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10694
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9898
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6339
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3547
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.