Hello folk!

My box: Windows 2000 Professional, .NET Framework SDK version 1.1, Oracle 8i Enterprice Edition 8.1.5.0

The following is the oracle.cs file in C# language. The purpose is to fill three data-bound controls (DataGrid, ListBox and ComboBox) with data from an Oracle database

-----------------------------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OracleClient;
namespace DBSampApp
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.listBox1 = new System.Windows.Forms.ListBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.Location = new System.Drawing.Point(8, 80);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(216, 216);
this.dataGrid1.TabIndex = 0;
//
// listBox1
//
this.listBox1.Location = new System.Drawing.Point(232, 80);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(120, 212);
this.listBox1.TabIndex = 1;
//
// comboBox1
//
this.comboBox1.DropDownWidth = 121;
this.comboBox1.Location = new System.Drawing.Point(360, 96);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 21);
this.comboBox1.TabIndex = 2;
this.comboBox1.Text = "comboBox1";
//
// button1
//
this.button1.Location = new System.Drawing.Point(16, 24);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(104, 24);
this.button1.TabIndex = 3;
this.button1.Text = "Fill Grid";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(224, 24);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(112, 24);
this.button2.TabIndex = 4;
this.button2.Text = "fill ListBox";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(360, 24);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(112, 24);
this.button3.TabIndex = 5;
this.button3.Text = "Fill Combo";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(480, 301);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button3,
this.button2,
this.button1,
this.comboBox1,
this.listBox1,
this.dataGrid1});
this.Name = "Form1";
this.Text = "Data-bound Controls Application";
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void button1_Click(object sender, System.EventArgs e)
{
// Creating connection and command sting
string conStr = "Data Source=manolo;User=usuario1;Password=uno";
string sqlStr = "SELECT * FROM emp";
// Create connection object
OracleConnection conn = new OracleConnection(conStr);
conn.Open();
// Create data adapter object

OracleDataAdapter da = new OracleDataAdapter(sqlStr,conn);

// Create a dataset object and fill with data using data adapter's Fill method
DataSet ds = new DataSet();
da.Fill(ds, "emp");

// Attach dataset's DefaultView to the datagrid control
dataGrid1.DataSource = ds.DefaultViewManager;
conn.Close();
}

private void button2_Click(object sender, System.EventArgs e)
{
// Creating connection and command sting
string conStr = "Data Source=manolo;User=usuario1;Password=uno";
string sqlStr = "SELECT * FROM emp";
// Create connection object
OracleConnection conn = new OracleConnection(conStr);
conn.Open();
// Create data adapter object
OracleDataAdapter da = new OracleDataAdapter(sqlStr,conn);

// Create a dataset object and fill with data using data adapter's Fill method
DataSet ds = new DataSet();
da.Fill(ds, "emp");

// Attach dataset's DefaultView to the datagrid control
DataView dv = ds.Tables["emp"].DefaultView;
listBox1.DataSource = dv;
listBox1.DisplayMember = "ename";
conn.Close();
}

private void button3_Click(object sender, System.EventArgs e)
{
// Creating connection and command sting
string conStr = "Data Source=manolo; User=usuario1; Password=uno";
string sqlStr = "SELECT * FROM emp";
// Create connection object
OracleConnection conn = new OracleConnection(conStr);
conn.Open();
// Create data adapter object
OracleDataAdapter da = new OracleDataAdapter(sqlStr,conn);

// Create a dataset object and fill with data using data adapter's Fill method
DataSet ds = new DataSet();
da.Fill(ds, "emp");

// Attach dataset's DefaultView to the datagrid control
DataView dv = ds.Tables["emp"].DefaultView;
comboBox1.DataSource = dv;
comboBox1.DisplayMember = "ename";
conn.Close();
}
}
}
-----------------------------------------

The compilation of this source was fine.

When I run oracle.exe appear a Windows Form with the three empty data-bound controls and three buttons.

When I click the button to fill the datagrid it fills with the following:

-------------------------------------------
EMPNO ENAME JOB
7369 SMITH CLERK
7499 ALLEN SALESMAN
7521 WARD SALE
7566 JONES MANAGER
7654 MARTIN SALESMAN
7698 BLAKE MANAGER
7782 CLARK MANA
7788 SCOTT ANALYST
7839 KING PRESIDENT
7844 TURNER SALESMAN
7876 ADAMS CLERK
7900 JAMES CLE
7902 FORD ANALYST
7934 MILLER CLERK
--------------------------------------
As you can see, some letters in the data retrieved from column JOB doesn't print.

When I click the button to fill the ListBox it fills with the following:

------------------------------------
System.Data.DataRowView
System.Data.DataRowView
System.Data.DataRowView
......
......
------------------------------------

When I click the button to fill the ComboBox it fills with the following:

------------------------------------
System.Data.DataRowView
System.Data.DataRowView
System.Data.DataRowView
......
......
------------------------------------

I tested the same code (changing the appropiate lines: using System.Data.SqlClient instead using System.Data.OracleClient, SqlConnection instead OracleConnection, etc..and ofcourse the table name and columns names) against a MS SQLServer and it works fine. The data retrieved to fill the data-bound controls are OK.

Somebody could tell me why it works against SQLServer and not against Oracle?

I will appreciate some clue.