Click here to Skip to main content
15,914,924 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Global change to a standard toolstrip [modified] Pin
Gilles Plante25-Jul-06 5:53
Gilles Plante25-Jul-06 5:53 
QuestionProblems with SQL to an Access Database Pin
Joshua Boyle24-Jul-06 9:27
Joshua Boyle24-Jul-06 9:27 
AnswerRe: Problems with SQL to an Access Database Pin
Colin Angus Mackay24-Jul-06 20:26
Colin Angus Mackay24-Jul-06 20:26 
GeneralRe: Problems with SQL to an Access Database [modified] Pin
Joshua Boyle25-Jul-06 3:56
Joshua Boyle25-Jul-06 3:56 
GeneralRe: Problems with SQL to an Access Database Pin
Joshua Boyle25-Jul-06 4:16
Joshua Boyle25-Jul-06 4:16 
GeneralRe: Problems with SQL to an Access Database Pin
Colin Angus Mackay25-Jul-06 4:52
Colin Angus Mackay25-Jul-06 4:52 
GeneralRe: Problems with SQL to an Access Database Pin
ChandraRam25-Jul-06 19:04
ChandraRam25-Jul-06 19:04 
Questionusing a data reader to add items to an arraylist Pin
ssbelfast24-Jul-06 7:59
ssbelfast24-Jul-06 7:59 
I'm trying to use a data reader to add items to an arraylist
I've tried several approaches - my code always reads the database correctly
( I can see the values it finds) but then I get an exception saying
Object reference not set to an instance of an object.


My original ideas were something like this:

Dim IdNums as arraylist
Dim command As OleDbCommand = con.CreateCommand()
command.CommandText = "SELECT Id from Candidates "
Dim reader As IDataReader = command.ExecuteReader
While (reader.Read())
m_ID = reader("id")
IdNums.Add(m_ID)

End while

OR
Dim IDNums as arraylist
Dim command As OleDbCommand = con.CreateCommand()
command.CommandText = "SELECT Id from Candidates "
Dim reader As IDataReader = command.ExecuteReader
Dim i As Integer = 0
While (reader.Read())

IdNums.Add(reader.GetValue(i))
End while

I thought the error message meant I had to create an object so I tried

Dim IDNums as arraylist
Dim command As OleDbCommand = con.CreateCommand()
command.CommandText = "SELECT Id from Candidates "
Dim reader As IDataReader = command.ExecuteReader
Dim IDobj As string = " "
While (reader.Read())

IdNums.Add(IDobj)
End while

but same results
Any thoughts

Thanks

AnswerRe: using a data reader to add items to an arraylist Pin
Dave Sexton25-Jul-06 0:40
Dave Sexton25-Jul-06 0:40 
GeneralRe: using a data reader to add items to an arraylist Pin
ssbelfast25-Jul-06 1:33
ssbelfast25-Jul-06 1:33 
QuestionUser Defined Type workaround using classes Pin
teepeetoo24-Jul-06 7:50
teepeetoo24-Jul-06 7:50 
QuestionLosing Global Variables Pin
ken11024-Jul-06 7:17
ken11024-Jul-06 7:17 
AnswerRe: Losing Global Variables Pin
Mandar Patankar24-Jul-06 11:25
Mandar Patankar24-Jul-06 11:25 
GeneralRe: Losing Global Variables Pin
ken11024-Jul-06 11:49
ken11024-Jul-06 11:49 
QuestionExcel macro Help Pin
awalle24-Jul-06 7:06
awalle24-Jul-06 7:06 
QuestionTableAdapter, Database Tutorial Pin
cstrader23224-Jul-06 6:38
cstrader23224-Jul-06 6:38 
AnswerRe: TableAdapter, Database Tutorial Pin
Dave Sexton25-Jul-06 0:36
Dave Sexton25-Jul-06 0:36 
AnswerRe: TableAdapter, Database Tutorial Pin
Nouvand4-Aug-06 0:19
Nouvand4-Aug-06 0:19 
QuestionDeclare Global variables in crystal reports Pin
ImranIBM24-Jul-06 6:19
ImranIBM24-Jul-06 6:19 
AnswerRe: Declare Global variables in crystal reports Pin
cs_senthil25-Jul-06 0:00
cs_senthil25-Jul-06 0:00 
QuestionProblem in Connection with Sql Server 2000 Pin
karansharma24-Jul-06 4:54
karansharma24-Jul-06 4:54 
AnswerRe: Problem in Connection with Sql Server 2000 Pin
Mandar Patankar24-Jul-06 11:28
Mandar Patankar24-Jul-06 11:28 
QuestionClosing Word Pin
goodoljosh198024-Jul-06 3:39
goodoljosh198024-Jul-06 3:39 
AnswerRe: Closing Word [modified] Pin
Rizwan Bashir24-Jul-06 21:57
Rizwan Bashir24-Jul-06 21:57 
QuestionApplying windows color schmes to controls Pin
rk4ps24-Jul-06 2:37
rk4ps24-Jul-06 2:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.