Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Query issue in C#

624071Feb 19 2008 — edited Feb 19 2008
I am trying to set up a query to populate a bunch of textboxes with the field from my query. In the query I need to make sure that the nulls are taken care of so I have nvl int he select statement. I anyone know why I am getting the following error and how to fix your help would be greatly appreciated. Thanks in advance.



ERROR: (the section in bold is where the error occurs)

IndexOutOfRangeException was unhandled

Index was outside the bounds of the array.




OracleConnection conn = new OracleConnection(constr);



conn.Open();

// Execute a SQL SELECT

OracleCommand cmd_ = conn.CreateCommand();

cmd_.CommandText =

"select nvl(address, ' '), nvl(account, ' '), nvl(sw_pidn, ' '), nvl(metersvc, ' ') from watermeters where customer = '"

+ Customer_name.Text + "'";

OracleDataReader dr = cmd_.ExecuteReader();


dr.Read();

Account_number.Text = dr.GetString(3);

Customer_address.Text = dr.GetString(5);

PID.Text = dr.GetString(10);

Land_type.Text = dr.GetString(7);

cmd_.Dispose();

conn.Dispose();

}

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2008
Added on Feb 19 2008
1 comment
544 views