0

I have a table in DB2 say premmp wherein a column say name might contain Arabic characters

Dim s As String = "SELECT EMPNO, NAME FROM lib.PRemmp where NAME like '% " & gname.text & " %'  ORDER BY RNAME "

where gname.text is a textbox. It does not work, anyone can help me?

I write this code

Adapter.SelectCommand = New OdbcCommand("SELECT EMPNO, NAME FROM lib.PRemmp where NAME like ?  ", MyODBCConnection)
Adapter.SelectCommand.Parameters.Add("@NAME", Odbc.OdbcType.NVarChar).Value = "%" & gname.Text
Adapter.SelectCommand.ExecuteNonQuery()
Adapter.Fill(ds, "MyTable")

it solve my problem thanks

  • 1
    Possible duplicate of [problem with WHERE clause matching on Arabic string](http://stackoverflow.com/questions/3868188/problem-with-where-clause-matching-on-arabic-string) – GSerg May 16 '17 at 09:51
  • Also please see http://stackoverflow.com/q/332365/11683 – GSerg May 16 '17 at 09:55
  • I have to explicitly tell DB2 that the Arabic string "at gname.text "is UNICODE. – Zeinab Hashem May 16 '17 at 10:25
  • If that was a question, then yes, you need to explicitly tell. – GSerg May 16 '17 at 10:30
  • You should provide length for the parameter and you should not call a `select` command with `ExecuteNonQuery()` as it makes no sense. – GSerg May 16 '17 at 11:22
  • @ZeinabHashem please post the solution that fixed your problem as an answer and edit it out of your question. This will help future visitors. – Bugs May 18 '17 at 10:40

0 Answers0