There is no problem inserting urdu text into SQL Server, but I have a problem searchig for urdu text - I keep getting:
0 rows effect
and text (which I want to search) is already in the SQL Server database.
This is my code:
con.Open();
string Query = "Select vendor.VendorID from vendor where vendor.Vendor_Name ='" + textBox4.Text + "'";
SqlDataAdapter SDA = new SqlDataAdapter(Query, con);
DataTable dt = new DataTable();
SDA.Fill(dt);
vend_id = (dt.Rows[0][0]).ToString();
con.Close();
Placing N
before string literals makes them unicode in SQL Server. You can do this like:
string Query = "Select vendor.VendorID from vendor where vendor.Vendor_Name =N'" + textBox4.Text + "'";
But this is prone to SQL Injection attacks. Please use parametrized queries that will handle unicode as well. Like this:
string Query = "Select vendor.VendorID from vendor where vendor.Vendor_Name =@Name";
//...
SDA.SelectCommand.Parameters.AddWithValue("@Name", textBox4.Text);