471,350 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

NVARCHAR and ODBC

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
Feb 9 '06 #1
0 1234

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Turloch O'Tierney | last post: by
2 posts views Thread by Vani Kancherlapalli | last post: by
3 posts views Thread by arijitchatterjee123 | last post: by
2 posts views Thread by Marc Filthaut | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.