checkbox oracle char type

  • Thread starter Thread starter mrstrong
  • Start date Start date
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
 
Peter,
I had a similar problem in VB .Net. Solution was to convert to string.
Depending on what I was working with I either used CSTR() or
expression.ToString

As for current row in a dataset, haven't seen any easy method. When I go to
a form, it's usually from a datagrid and I use CurrentRowIndex. Or if
sorted, find the record I want.
 
mrstrong said:
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')

should be: =="Y"

oracle pl/sql -> c# caused my confusion.

Thanks,

Peter
 
Back
Top