[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

I couldn't get the value of a column at a specific ordinal from a datareader.

Posted on 2008-06-09
3
Medium Priority
?
160 Views
Last Modified: 2010-04-23
Something worked for me the last time around ---  myrow(mycold1) = autoreader.GetValue(2)
but now, it,autoreader.getvalue(2), only return the column name.  
What I want is the content of the datareader's column returned from a datareader.read() method.
If I try to use datareader.getstring(2), I got a 'cast' exception.

Using autoreader As System.Data.OleDb.OleDbDataReader = selectCmd.ExecuteReader()
                        autoreader.Read()
                        myrow = _DtText.NewRow()
                        myrow(mycol) = autoreader.GetValue(2)

Open in new window

0
Comment
Question by:isischen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Expert Comment

by:raja_ind82
ID: 21748510
try this...

autoreader.fields(0).value

Regards,
M.Raja
0
 
LVL 14

Accepted Solution

by:
rachitkohli earned 1500 total points
ID: 21748715
myrow(mycol) = autoreader.Item("ColumnName")
0
 
LVL 14

Expert Comment

by:raja_ind82
ID: 21749024
rachitkohli  is correct.  sorry,  my answer is working only in VB.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question