View Single Post
Old 08-27-2005, 02:29 AM   PM User | #4
nikkiH
Senior Coder

 
nikkiH's Avatar
 
Join Date: Jun 2005
Location: Near Chicago, IL, USA
Posts: 1,973
Thanks: 1
Thanked 32 Times in 31 Posts
nikkiH is on a distinguished road
Okay, forgive me I usually use C# (and get better error messages with a line number and the code that errored out, which is set in the config file somewhere), but I believe this is wrong.

Dim Conn As New OdbcConnection("ConnStr")
You're supposed to pass that a connection, not a string.

Dim Conn As New OdbcConnection(ConnStr)
Note: no quotes.

So, no connection, which would make this line throw a nullpointerexception:
Conn.Open()
or maybe this one...
Dim Cmd As New OdbcCommand("SELECT anstext FROM Ans_Options", Conn)

No conn, no object. No object, nullpointerexception...
__________________

If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit
http://www.kaelisspace.com/
nikkiH is offline   Reply With Quote