G
Guest
I'm a VB.net programmer currently battling to build new apps in C#, and MAN!
It's been a bit frustrating, to say the least.
I've done quite a bit of progamming with Java and C back in the day, so I
can deal with the case sensitiviness and semicolens, but I'm finding certain
aspects of the language to be a real pain.
Well, to get to the point, here's a problem that I'd appreciate it if
someone could help me...
Note: dsResponse is a dataset being populated by an xml file.
In code, I have the following:
//This works:
if (dsResponse.ReservationResponse.Rows[0].ItemArray.GetValue(0).ToString()
== "Fail")
//This doesn't work
if (dsResponse.ReservationResponse.Rows[0].ItemArray["Status"] == "Fail")
error: Cannot implicitly convert type 'string' to 'int'
In the command window:
//this works
dsResponse.ReservationResponse.Rows[0].ItemArray["Status"]
//this DOESN'T:
dsResponse.ReservationResponse.Rows[0].ItemArray.GetValue(0).ToString()
Error:
'dsResponse.ReservationResponse.Rows[0].ItemArray.GetValue(0.ToString' does
not exist
What I would like to accomplish is to be able to use the NAME of the field,
and not the index value, to retrieve the value of that item.
WHAT GIVES?
tia
It's been a bit frustrating, to say the least.
I've done quite a bit of progamming with Java and C back in the day, so I
can deal with the case sensitiviness and semicolens, but I'm finding certain
aspects of the language to be a real pain.
Well, to get to the point, here's a problem that I'd appreciate it if
someone could help me...
Note: dsResponse is a dataset being populated by an xml file.
In code, I have the following:
//This works:
if (dsResponse.ReservationResponse.Rows[0].ItemArray.GetValue(0).ToString()
== "Fail")
//This doesn't work
if (dsResponse.ReservationResponse.Rows[0].ItemArray["Status"] == "Fail")
error: Cannot implicitly convert type 'string' to 'int'
In the command window:
//this works
dsResponse.ReservationResponse.Rows[0].ItemArray["Status"]
//this DOESN'T:
dsResponse.ReservationResponse.Rows[0].ItemArray.GetValue(0).ToString()
Error:
'dsResponse.ReservationResponse.Rows[0].ItemArray.GetValue(0.ToString' does
not exist
What I would like to accomplish is to be able to use the NAME of the field,
and not the index value, to retrieve the value of that item.
WHAT GIVES?
tia