Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 16th, 2005, 10:10 PM   #1
Intimidat0r
Hobbyist Programmer
 
Intimidat0r's Avatar
 
Join Date: May 2005
Location: Don't know, but the padded walls are a nice touch.
Posts: 126
Rep Power: 0 Intimidat0r is an unknown quantity at this point
Send a message via ICQ to Intimidat0r Send a message via AIM to Intimidat0r Send a message via MSN to Intimidat0r Send a message via Yahoo to Intimidat0r
OleDB

This is really ASP.NET, but I'm using VB as the language, so I thought i'd post it here for lack of a better place.

anyway, i have this code:

		Dim objConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DBPath))
		Try
			objConn.Open()
		Catch ex As OleDbException
			Response.Write("<script>alert('Could not connect to the database.\nPlease contact the administrator.');</script>")
			Exit Sub
		End Try

		Dim objCmd As New OleDbCommand("SELECT post FROM teacher_info WHERE username='" & Session.Item("Username") & "'", objConn)
                'ERROR LINE JUST BELOW
		Dim objDataReader As OleDbDataReader = objCmd.ExecuteReader
                'ERROR LINE JUST ABOVE
		objDataReader.Read()

		txtBulliten.Text = objDataReader.Item("post")

and when i try to run it the line i marked as error line throws a oledbexception. anybody have any idea what's wrong? thanks.
__________________
Children in the dark cause accidents, and accidents in the dark cause children.

http://www.ronincoders.org
Intimidat0r is offline   Reply With Quote
Old Nov 16th, 2005, 10:28 PM   #2
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
What is the exception message?
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Old Nov 16th, 2005, 10:32 PM   #3
Intimidat0r
Hobbyist Programmer
 
Intimidat0r's Avatar
 
Join Date: May 2005
Location: Don't know, but the padded walls are a nice touch.
Posts: 126
Rep Power: 0 Intimidat0r is an unknown quantity at this point
Send a message via ICQ to Intimidat0r Send a message via AIM to Intimidat0r Send a message via MSN to Intimidat0r Send a message via Yahoo to Intimidat0r
the exception message:

Quote:
No value given for one or more required parameters.
__________________
Children in the dark cause accidents, and accidents in the dark cause children.

http://www.ronincoders.org
Intimidat0r is offline   Reply With Quote
Old Nov 17th, 2005, 11:39 AM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Take a look at the MSDN page - you have to implement it in a specific way.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Nov 17th, 2005, 8:11 PM   #5
Intimidat0r
Hobbyist Programmer
 
Intimidat0r's Avatar
 
Join Date: May 2005
Location: Don't know, but the padded walls are a nice touch.
Posts: 126
Rep Power: 0 Intimidat0r is an unknown quantity at this point
Send a message via ICQ to Intimidat0r Send a message via AIM to Intimidat0r Send a message via MSN to Intimidat0r Send a message via Yahoo to Intimidat0r
um, is there something im missing between the example and what i have?
__________________
Children in the dark cause accidents, and accidents in the dark cause children.

http://www.ronincoders.org
Intimidat0r is offline   Reply With Quote
Old Nov 18th, 2005, 5:43 PM   #6
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Sorry - I thought there was, but it seems your code should be fine, semantically at least. What exactly is the error message?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Nov 20th, 2005, 11:26 PM   #7
melbolt
Hobbyist Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 244
Rep Power: 4 melbolt is on a distinguished road
Send a message via AIM to melbolt Send a message via Yahoo to melbolt
hmm, it looks good to me, I know this may sound stupid but try putting a () on the end

like in the example on MSDN:
myReader = myCommand.ExecuteReader()

I've seen dumber things happen before in .NET, it should automatically put it in there, I assume you copy/pasted this, it should be in there. I've actually had errors as a result of this before, give it a try.

so try changing this:
Dim objDataReader As OleDbDataReader = objCmd.ExecuteReader

to this:
Dim objDataReader As OleDbDataReader = objCmd.ExecuteReader()

lemme know if this makes a difference, I'm curious
__________________
I have never let my schooling interfere with my education. -Mark Twain-

Xbox live gamertag: melbolt
melbolt is offline   Reply With Quote
Old Nov 21st, 2005, 11:04 AM   #8
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
That makes sense... I know in VB you didn't have to do that (it actually caused an error), but in VB .NET they could have changed it.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:50 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC