TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
David Smith
NA
2k
0
C#: Reader.GetString(0) Error: Invalid Cast
Sep 29 2010 12:20 AM
Can someone assist me, Im getting a error below where there red, Reader.GetString(0);
private bool GetMDBFile(string fileName, ref Raytheon.Elau.Common.ImportLog impLgStatus)
{
FileInfo fn = new FileInfo(fileName);
impLgStatus = new Raytheon.Elau.Common.ImportLog();
StringBuilder sbStringBuilder = new StringBuilder();
OleDbDataReader Reader = null;
String sCommand = "INVALID COMMAND";
OleDbCommand objCommand = new OleDbCommand();
const String query = "SELECT TPC_ID FROM TestObjectEvent;";
objCommand = new OleDbCommand(sCommand, objConnection);
try
{
objCommand.CommandText = query;
Reader = objCommand.ExecuteReader();
while (Reader.Read())
{
tpcIDs.Add(Reader.GetString(0)); -----------------------------------------------------------------Im getting a error at this particular line, saying invalid cast and I dont know why. Its
saids invalid cast
}
Reader.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Reply
Answers (
1
)
Certificate .NET 3.5
iframe function working in firefox but not working in internet explorer