Hello All,
I am using ODBC, connecting to an Oracle table that has a column of type
NVARCHAR.
When I try to retrieve data into a string, I don't see it. I imagine its
because the null padding in the data.
Here is some simplified code to show my issue.
// Oracle Table
// CREATE TABLE TableX
// ( EngColumn VARCHAR2(200),
// NLSColumn NVARCHAR2(400));
// EngColumn NLSColumn
// This is some text T h i s i s s o m e
t e x t
// Here is more text H e r e i s m o r e
t e x t
using System.Data;
using System.Data.Odbc;
private void InitializeData()
{
// MyConnection is an OdbcConnection control
OdbcConnection MyConnection = new OdbcConnection();
MyConnection.ConnectionString = = "DSN=" + HostName +
";UID=" + UserName + ";PWD=" + Password + ";";
string Query = "SELECT * FROM TableX";
MyConnection.Open();
OdbcDataAdapter daResults = new OdbcDataAdapter(Query, MyConnection);
MyConnection.Close();
DataTable dtResults = new DataTable();
daResults.Fill(dtResults);
DataGrid1.DataSource = dtResults;
}
private void DataGrid1_CurrentCellChanged(object sender, System.EventArgs e)
{
MessageBox.Show(DataGrid1[DataGrid1.CurrentCell].ToString());
}
If I select a cell in the "EngColumn" I see the data. If I select a cell in
the NLSColumn, I get a blank string. I figure that it is something to do
with Unicode conversion, but I just can't seem to figure it out.
TIA,
pagates