Hello all,
I am very new to Oracle and I keep getting this error in .Net and I don't know why...
I am using Oracle 8.1.7, C# and using System.Data.OracleClient
I selected OracleDataAdaptor from the toolbox and created a new connection and tested it and it was successful.
I built my program and there are no errors but when the page loads I get the error mentioned in the subject heading.
It says the error occurs at conn.Open();
Does anyone know how to go about and try to fix this error?
By the way here is that section of code:
protected
System.Data.OracleClient.OracleDataAdapter oracleDataAdapter1;
protected System.Data.OracleClient.OracleCommand oracleSelectCommand1; // Selects all the columns in the db
protected System.Data.OracleClient.OracleCommand oracleInsertCommand1;
protected System.Data.OracleClient.OracleConnection conn; // Tested connection and it worked
protected System.Web.UI.WebControls.ListBox nameListBox;
private void Page_Load(object sender, System.EventArgs e)
{
using(conn)
using(oracleSelectCommand1)
{
oracleSelectCommand1.Connection = conn;
conn.Open();
OracleDataReader reader = oracleSelectCommand1.ExecuteReader();
while(reader.Read())
nameListBox.Items.Add(new ListItem(reader.GetString(0)));
reader.Close();
}
Thanks.
DAN