SQL Server - Fetch gujarati data from Database using Like Statment

Asked By Pritesh on 19-Apr-11 06:56 AM
I have one table thats store gujarati data. how can I fetch gujarati data from database using Like statment.
1 colume First name="હિરેન"  how to fetch this using select statment using store procedure.? ples give me ans fast
Nikhil Mahajan replied to Pritesh on 19-Apr-11 07:19 AM

First... if you have stored gujrati data to sql server....
then to read you must have gujrati fonts insatlled on that system

if you have installed then just check the below query.. it will get data from database using gujrati lang...

            SqlCommand cmd = new SqlCommand("select * table where name like @name+'%' ", con);
            cmd.Parameters.AddWithValue("@name", SqlDbType.NVarChar).Value = txt_name.Text;    //Texbox name
            GridView1.DataSource = cmd.ExecuteReader();

you just have to make the datatype Nvarchar then it will display the data as it is stored in sql server.....

it will definaltly solve your problem.......
dipa ahuja replied to Pritesh on 19-Apr-11 07:50 AM
Stored Procedure:

ALTER PROCEDURE dbo.StoredProcedure1
	@ename nvarchar
	select from emp where  ename like ''+ @ename + '%';

.CS Code:
protected void Button1_Click(object sender, EventArgs e)
  string conn = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
  SqlConnection con = new SqlConnection(conn);
  SqlCommand comm = new SqlCommand("StoredProcedure1", con);
  comm.CommandType = CommandType.StoredProcedure;
  comm.Parameters.AddWithValue("@ename", TextBox1.Text.ToString());
  SqlDataAdapter da = new SqlDataAdapter(comm);
  DataTable dt = new DataTable();
  GridView1.DataSource = dt;

Hope this will help you!