checkbox oracle char type

M

mrstrong

Gday,

I have a checkbox on my windows forms that I need to set based on a
value in a dataset which is populated by an odp data adapter via a web
service.
The value in the oracle database is of type char(1) with possible values 'Y'
or 'N' (there are no boolean values in oracle).

The code (c#) that I currently have that is being called from the form's
load procedure to set the checkbox is as follows:

if (dsMyDataSet.Tables[<table>].Rows[0][<field>]== 'Y')

chkBox.Checked = true;

else

chkBox.Checked = false;



However there are two issues that I hope you might be able to point me
in the right direction with:

1. How do you do comparisons for type char? (I get this message:
Operator
'==' cannot be applied to operands of type 'object' and 'char')

2. I am not sure how to reference the current row in the dataset

If this is not the right forum please point me in the right direction.

Regards,

Peter
 
N

nankailzq

Hi,
You can use the ToString() functaion like this:
dsMyDataSet.Tables[<table>].Rows[0][<field>]== "Y"
Note:
It's "Y" not 'y'.
I hope that help you.
 
N

nankailzq

Sorry,last relpy have a mistake ,
you should add ToString() after that DataRow
like :
dsMyDataSet.Tables[<table>].Rows[0][<field>].ToString()== 'Y'
Sorry for that Mistake!
 
M

mrstrong

nankailzq said:
Hi,
You can use the ToString() functaion like this:
dsMyDataSet.Tables[<table>].Rows[0][<field>]== "Y"
Note:
It's "Y" not 'y'.
I hope that help you.

thanks! oracle pl/sql -> c# caused my confusion with the quotes.

Regards,

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top