reader and number of column

M

Miliuccio

Can i not read with column NUMBER but by COLUMNNAME?

rdr.GetString(0)

but ?? rdr.GetString(NOMECOLONNA)??
 
P

Peter Foot [MVP]

You can either use the default indexer to retrieve the field value e.g.

rdr(NOMECOLONNA)

or use GetOrdinal method with the typed Get methods e.g.

rdr.GetString(rdr.GetOrdinal(NOMECOLONNA))

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top