[IWE] C# ODBCReader questions
Chris Rathman
iwe@warhead.org.uk
Fri, 12 Jan 2007 10:52:57 -0600
You access it either way. Rs["Example"] or Rs[n]. Accessing by index
is faster since it doesn't have to do a dictionary search.
Chris.
Barry Roomberg wrote:
> Since I can get the count of fields, and I can loop throught that, is there
> any what, given a numeric index, to determine the name of the field?
> This would enable generaric setup / assign code.
>
> On Friday 12 January 2007 11:43, Chris Rathman wrote:
>
>> I've used OleDbDataReader and SqlDataReader in the past, but I'm not
>> sure of the particular type for ODBC? I put together some notes on C#
>> that might be useful (see the section on databases):
>>
>> http://www.angelfire.com/tx4/cus/notes/csharp-syntax.html
>>
>> In general, I could have something like:
>>
>> ... bunch of code to set up Command....
>>
>> OleDbDataReader Rs = Cmd.ExecuteReader();
>> Rs.Read();
>> while (Rs.Read())
>> {
>> string example = (string)Rs["Example"];
>> }
>>
>> So, the answer is likely that you want to use the associative array that
>> corresponds to the data reader object.
>>
>> Chris.
>>
>> Barry Roomberg wrote:
>>
>>> If I do a "select *" in an ODBC connection, and then have the reader
>>> pulling the data, how can I pull the assoicated field name from the
>>> reader array? _______________________________________________
>>> IWE mailing list
>>> IWE@warhead.org.uk
>>> http://lists.warhead.org.uk/mailman/listinfo/iwe
>>>
>> _______________________________________________
>> IWE mailing list
>> IWE@warhead.org.uk
>> http://lists.warhead.org.uk/mailman/listinfo/iwe
>>
> _______________________________________________
> IWE mailing list
> IWE@warhead.org.uk
> http://lists.warhead.org.uk/mailman/listinfo/iwe
>
>