F
Frank Milverckowitz
Hi,
Newbie question about SqlDataReader column value access...
In java jdbc code to get a value from a table column we can pass the column
name (instead of an int index or offset):
String strLastName = rs.getString( "LastName" );
Now, let's say that LastName is the 14th column in the table...
Does this mean that in .NET SqlDataReader my only option is to define my own
equates to map column indexes to string values?
For example, Using the SqlDataReader it looks like my only option is to pass
an index for the column I want the value from:
string strLastName = sdr.GetString( 13 );
or do I need to define my own equates for every table in my database so that
my code is readable?
(e.g.)
class MyDatabaseTableClass
....
public int LAST_NAME = 13;
public int ADDRESS_LINE1 = 14;
public int ADDRESS_LINE2 = 15;
Or am I just not finding the method I am looking for here?
thanks for any tips,
Frank
Newbie question about SqlDataReader column value access...
In java jdbc code to get a value from a table column we can pass the column
name (instead of an int index or offset):
String strLastName = rs.getString( "LastName" );
Now, let's say that LastName is the 14th column in the table...
Does this mean that in .NET SqlDataReader my only option is to define my own
equates to map column indexes to string values?
For example, Using the SqlDataReader it looks like my only option is to pass
an index for the column I want the value from:
string strLastName = sdr.GetString( 13 );
or do I need to define my own equates for every table in my database so that
my code is readable?
(e.g.)
class MyDatabaseTableClass
....
public int LAST_NAME = 13;
public int ADDRESS_LINE1 = 14;
public int ADDRESS_LINE2 = 15;
Or am I just not finding the method I am looking for here?
thanks for any tips,
Frank