Make sure that the column you plan to store the text in supports unicode (nvarchar, ntext, nchar etc) and then simply insert it and select it in the same way you would for normal (English) text
I am also a developer in Moscow and using Russian text in my application. Are you sure that you are not missing N'' convention?
See following example. INSERT statement has 2 entry. First one is being used by N'' but second one without N''. As long as you use N'' for text types, russian characters will be recognized automatically and you dont need to anytthing. Your client controls
will render russian characters without any problem.
CREATE TABLE [dbo].[Table_Test]
(
Column1 [nchar](10) NULL
)
INSERT INTO [dbo].[Table_Test]
( Column1)
VALUES
(N'Привет')
,('Привет')
SELECT Column1
FROM [dbo].[Table_Test]
i dont want like this , i can do this like you. but when i insert ruussian text from admin side website page its give me like that text when i can insert ??????????????????????????????????????????????????????????????????????????????????????
so my data type also correct and when i can edit in database and i can write russain text its working but on webiste when i can insert its not working , give me that message ???????????????????????????????????????
so please give me the code of c# how can i insert russian text
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Security; using System.Security.Permissions; using System.IO; using System.Text;
public partial class Adm_product_add_Home : System.Web.UI.Page { DBcommand DBAcquire = new DBcommand(); protected void Page_Load(object sender, EventArgs e) { Label prd_info = new Label(); if (!Page.IsPostBack) {
string type = Request.QueryString["type"].ToString(); if (type == "add") {
} else { DBAcquire.open_conn(); int id = DBAcquire.GetID("select catid from Home where Cat='" + Request.QueryString["catid"] + "'");
DBAcquire.new_comm("select Cat, description from Home where catid=" + id + ""); DBAcquire.DBReader(); if (DBAcquire.readDB.Read()) { home_Title.Text = DBAcquire.readDB.GetValue(0).ToString(); Home_name.Text = DBAcquire.readDB.GetValue(1).ToString(); // prd_info.Text = DBAcquire.readDB.GetValue(1).ToString(); }
DBAcquire.open_conn(); int id = DBAcquire.GetID("select Catid from Home where Cat='" + Request.QueryString["Catid"] + "'"); string qry; qry = string.Format("update Home set Cat ='" + home_Title.Text + "', description='" + Home_name.Text + "' where Catid=" + id + ""); DBAcquire.new_comm(qry); Response.Write(qry); DBAcquire.executecommand(); DBAcquire.comm.Cancel(); DBAcquire.close_conn(); }
Response.Redirect("default.aspx"); } }
my class code is here DBCommand.cs page code
using System; using System.Collections.Generic; using System.Web; using System.Data.Sql; using System.Configuration; using System.Data.SqlClient; using System.Collections; /// <summary> /// Summary description for DBcommand /// </summary> public class DBcommand { #region Global Variables SqlConnection conn; public SqlCommand comm, comm1; public SqlDataReader readDB, readDB1; #endregion public DBcommand() { // // TODO: Add constructor logic here // conn = new SqlConnection();
} public void open_conn() { if (conn.State == System.Data.ConnectionState.Closed) {
zubair258
Member
112 Points
129 Posts
Russia Text insert into database and how to get
Dec 05, 2011 06:33 AM|LINK
Mikesdotnett...
All-Star
154927 Points
19867 Posts
Moderator
MVP
Re: Russia Text insert into database and how to get
Dec 05, 2011 06:36 AM|LINK
Make sure that the column you plan to store the text in supports unicode (nvarchar, ntext, nchar etc) and then simply insert it and select it in the same way you would for normal (English) text
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
zubair258
Member
112 Points
129 Posts
how to insert Russia language text into database and how to get
Dec 05, 2011 06:47 AM|LINK
zubair258
Member
112 Points
129 Posts
Re: Russia Text insert into database and how to get
Dec 05, 2011 06:54 AM|LINK
dear not working i can changes this
my datatype is nvarchar(4000) but nor working , its give me that type of text ????????????????????????????????????????????????
when i can insert russia text from the website
please solve my problem
mayankpathak...
Contributor
3643 Points
844 Posts
Re: how to insert Russia language text into database and how to get
Dec 05, 2011 06:54 AM|LINK
hey there
whenever you need to insert any other language's content into database you will have to use nvarchar, ntext, or nchar type of datatypes in
database columns because these datatypes supports multilingual texts and have Unicode support also. so you need to enter your content in
russian language and save it in database into nvarchar , ntext or nchar columns. and while displaying if you want to convert russian language into
english then you can use google language translator or use resource file in asp.net for multilingual support. Check these links
http://www.codeproject.com/KB/cs/multilingual.aspx
http://www.codeproject.com/KB/cs/multilingual_pplication.aspx
http://www.codeproject.com/KB/cs/Multilingual_application.aspx
mezzanine74
Contributor
2480 Points
730 Posts
Re: how to insert Russia language text into database and how to get
Dec 05, 2011 06:57 AM|LINK
Hi,
I am also a developer in Moscow and using Russian text in my application. Are you sure that you are not missing N'' convention?
See following example. INSERT statement has 2 entry. First one is being used by N'' but second one without N''. As long as you use N'' for text types, russian characters will be recognized automatically and you dont need to anytthing. Your client controls will render russian characters without any problem.
CREATE TABLE [dbo].[Table_Test] ( Column1 [nchar](10) NULL ) INSERT INTO [dbo].[Table_Test] ( Column1) VALUES (N'Привет') ,('Привет') SELECT Column1 FROM [dbo].[Table_Test]zubair258
Member
112 Points
129 Posts
Re: how to insert Russia language text into database and how to get
Dec 05, 2011 09:00 AM|LINK
sorry dear
i dont want like this , i can do this like you. but when i insert ruussian text from admin side website page its give me like that text when i can insert ??????????????????????????????????????????????????????????????????????????????????????
so my data type also correct and when i can edit in database and i can write russain text its working but on webiste when i can insert its not working , give me that message ???????????????????????????????????????
so please give me the code of c# how can i insert russian text
english text is working and insert normally .
thanks
mezzanine74
Contributor
2480 Points
730 Posts
Re: how to insert Russia language text into database and how to get
Dec 05, 2011 09:15 AM|LINK
Hi,
How is your INSERT statement look like? Which control are you using to INSERT data, SqlDataSource or etc?
zubair258
Member
112 Points
129 Posts
Re: how to insert Russia language text into database and how to get
Dec 05, 2011 10:07 AM|LINK
default.aspxback end codeon default.aspx.cs pagemy class code is here DBCommand.cs page codecheck this three file i can insert when i click on ADD button then go to the default.aspx page , i can send query string to this pagelike thisdatabase table code heremezzanine74
Contributor
2480 Points
730 Posts
Re: how to insert Russia language text into database and how to get
Dec 05, 2011 11:09 AM|LINK
Hi,
Please use following syntax in your INSERT and UPDATE commands. Try to add N for text parameters
str = string.Format("insert into Home (Cat, description, pos) values (N'" + home_Title.Text + "',N'" + Home_name.Text + "'," + pass + ")");
qry = string.Format("update Home set Cat = N'" + home_Title.Text + "', description= N'" + Home_name.Text + "' where Catid=" + id + "");
</div>