I am using this code to read data from Oracle Database. That data stored in Oracle is Navarchar2 data type but when It it display in gridview it looks like this. ?& ? ?????? ??? ? My database Charaacter set is WE8MSWIN1252
Here is mY code through which I am reading from Oracle database.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim con = New OleDbConnection("Data Source=cms; User ID=cms20112012; Password=??????; provider=OraOLEDB.Oracle")
con.open()
Dim cmd As New OleDbCommand("Select to_char(grower_Name) grower from V_GROW", con)
Dim da As New OleDbDataAdapter(cmd)
Dim ds As New DataSet
Dim I As Long
da.Fill(ds, "V_GROW")
GridView1.DataSource = ds
GridView1.DataBind()
For I = 0 To ds.Tables("V_GROW").Rows.Count - 1
Dim grower As String = ds.Tables("V_GROW").Rows(I).Item("grower")
grower = Encoding.ASCII.GetString(Encoding.Unicode.GetBytes(grower))
Label1.Text = grower
Next I
con.close()
End Sub
Please anyone help me to get out of this issue
Your database needs to use the UTF encoding or it will not store / retrieve correctly. When you setup the Oracle database – you must set the character set (National and Database) to UTF.