A
ad
When we user SqlDataReader, we can use integer or string as index.
For example, if the query string is :
Select Math, Nature, Social form Scores"
and the myRD is the SqlDataReader,
We can refer a field by myRD[0], or myRD["Math"]
But how can we get the string index for the integer index.
For example,
sting sPassSubjects
for (int i=0; i<3, i++)
{
if (myRD>60)
sPassSubjects+=GetSubject(i);
}
The GetSubject function can return a subject for index, like if i=0, then
return "Math",
i=2, return Social.
How can I write this function?
For example, if the query string is :
Select Math, Nature, Social form Scores"
and the myRD is the SqlDataReader,
We can refer a field by myRD[0], or myRD["Math"]
But how can we get the string index for the integer index.
For example,
sting sPassSubjects
for (int i=0; i<3, i++)
{
if (myRD>60)
sPassSubjects+=GetSubject(i);
}
The GetSubject function can return a subject for index, like if i=0, then
return "Math",
i=2, return Social.
How can I write this function?