473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Strange Issue / DB Error / Not Showing Error Message

Good morning all,

I am trying to access an access database to authenticate users upon
logging into my application.

Something is throwing an excecption. My error handling code should
display this message in a msgbox. However, the messagebox is always
empty.

Here is my error handling code.

Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OKOnly)
Finally
oleConn.Close()
End Try

Return bolTemp
End Function

Am I missing something? Do I have to include any system libraries for
error handling? Very confusing.....

Thanks in advance!

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Oct 11 '06 #1
13 1613
If you step through the code, when entering the Catch block the ide's
exception helper should pop up if you hover over "catch ex as
exception" line. See if that gives any additional information. If that
doesn't help solve the problem then what code is causing the error?

Thanks,

Seth Rowe
Ivan Weiss wrote:
Good morning all,

I am trying to access an access database to authenticate users upon
logging into my application.

Something is throwing an excecption. My error handling code should
display this message in a msgbox. However, the messagebox is always
empty.

Here is my error handling code.

Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OKOnly)
Finally
oleConn.Close()
End Try

Return bolTemp
End Function

Am I missing something? Do I have to include any system libraries for
error handling? Very confusing.....

Thanks in advance!

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Oct 11 '06 #2
Ivan Weiss wrote:
Good morning all,

I am trying to access an access database to authenticate users upon
logging into my application.

Something is throwing an excecption. My error handling code should
display this message in a msgbox. However, the messagebox is always
empty.
Do you, by chance, run McAfee Virus Scanner? That can cause the
message box to be blank. They have released a patch to fix the
problem.

If you search these groups, you should find more information on it as
it pops up occaisionally.

Chris

Oct 11 '06 #3
Chris,

I do happen to have Mcafee Virus Scan installed. I could not find
anything on that. Do you happen to know where I can get the patch. I
tried searching on Mcafee web site as well...

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Oct 11 '06 #4
Seth,

It did not display any further information.

Here is the code: It is a function within a User class that I am using
to authenticate my user that is logging in. I simply put in a user name
and a password and hit submit and it references this class:

Public Function ValidUser(ByVal UserName As String, ByVal Password As
String) As Boolean
Dim bolTemp As Boolean = False

Try
strSQL = "SELECT Roles FROM Employees WHERE (UserName = " &
UserName & ") AND (Password = " & Password & ")"
oleConn = New OleDbConnection(strConString)
oleCmd = New OleDbCommand

oleConn.Open()

With oleCmd
.CommandText = strSQL
.CommandType = CommandType.Text
.Connection = oleConn
oleReader = .ExecuteReader(CommandBehavior.SingleRow)
End With

While oleReader.Read
bolTemp = True
UserRole = oleReader(0)
End While

oleReader.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OKOnly)
Finally
oleConn.Close()
End Try

Return bolTemp
End Function
-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Oct 11 '06 #5
UserRole = oleReader(0)

What is UserRole? Also is this the line that is throwing the error? If
not which line is?

Thanks,

Seth Rowe
Ivan Weiss wrote:
Seth,

It did not display any further information.

Here is the code: It is a function within a User class that I am using
to authenticate my user that is logging in. I simply put in a user name
and a password and hit submit and it references this class:

Public Function ValidUser(ByVal UserName As String, ByVal Password As
String) As Boolean
Dim bolTemp As Boolean = False

Try
strSQL = "SELECT Roles FROM Employees WHERE (UserName = " &
UserName & ") AND (Password = " & Password & ")"
oleConn = New OleDbConnection(strConString)
oleCmd = New OleDbCommand

oleConn.Open()

With oleCmd
.CommandText = strSQL
.CommandType = CommandType.Text
.Connection = oleConn
oleReader = .ExecuteReader(CommandBehavior.SingleRow)
End With

While oleReader.Read
bolTemp = True
UserRole = oleReader(0)
End While

oleReader.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OKOnly)
Finally
oleConn.Close()
End Try

Return bolTemp
End Function
-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Oct 11 '06 #6
UserRole is a property:

Public Property UserRole() As String
Get
If strUserRole <"" Then
Return strUserRole
Else
MsgBox("You are not Logged in. System will Exit.
Restart and Login")
Application.Exit()
End If
End Get
Set(ByVal Value As String)
strUserRole = Value
End Set
End Property

After this line is run, it goes to the error handling code so this must
be the culpret but I have no clue why:

oleReader = .ExecuteReader(CommandBehavior.SingleRow)

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Oct 12 '06 #7

Ivan Weiss wrote:
Chris,

I do happen to have Mcafee Virus Scan installed. I could not find
anything on that. Do you happen to know where I can get the patch. I
tried searching on Mcafee web site as well...

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
http://tinyurl.com/k8jgx

Oct 12 '06 #8
oleReader = .ExecuteReader(CommandBehavior.SingleRow)

Let's pull this out of the with block and drop the parameter.

i.e.

oleReader = objCmd.ExecuteReader()

Also I didn't see anywhere that you dimensioned the oleReader object.
Is this done somewhere other than in the code you supplied?

Thanks,

Seth Rowe
Ivan Weiss wrote:
UserRole is a property:

Public Property UserRole() As String
Get
If strUserRole <"" Then
Return strUserRole
Else
MsgBox("You are not Logged in. System will Exit.
Restart and Login")
Application.Exit()
End If
End Get
Set(ByVal Value As String)
strUserRole = Value
End Set
End Property

After this line is run, it goes to the error handling code so this must
be the culpret but I have no clue why:

oleReader = .ExecuteReader(CommandBehavior.SingleRow)

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Oct 12 '06 #9
Hi Seth,

That Mcafee issue did solve the disappearing message box screen and now
I am getting some actual errors.

Adjusting the olereader outside of the With block and removing the
parameter did not help.

Here is the general dimensioning of variables for the class. It is
coded prior to any properties or subs

Private strConString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Documents and Settings\iweiss\My Documents\elite.mdb;User
Id=admin;Password=;"
Private oleCmd As OleDbCommand
Private oleConn As OleDbConnection
Private oleReader As OleDbDataReader
Private strUserRole As String = ""
Private strSQL As String = ""

The errors in the message box are as follows:

"No Value given for one or more required parameters."

Thanks for your help thus far.

PS--- I cant find that patch to resolve the virusscan issue other than
manually disabling buffer overrun so if anyone has it or knows
specifically where to get it that would help!

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Oct 16 '06 #10
Ah ha! Some error messages! First, make sure that the username and
password variables in your SQL statement aren't nothing (or try
hardcoding them in just to narrow down issues). If that all fails,
rebuild your SQL statement using OleDb parameters. Here's a link to Cor
Ligthert and Ken Tuckers sight that has sample code:

http://www.vb-tips.com/dbpages.aspx?...3-eb8b44af0137

Hope that helps,

Seth Rowe
Ivan Weiss wrote:
Hi Seth,

That Mcafee issue did solve the disappearing message box screen and now
I am getting some actual errors.

Adjusting the olereader outside of the With block and removing the
parameter did not help.

Here is the general dimensioning of variables for the class. It is
coded prior to any properties or subs

Private strConString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Documents and Settings\iweiss\My Documents\elite.mdb;User
Id=admin;Password=;"
Private oleCmd As OleDbCommand
Private oleConn As OleDbConnection
Private oleReader As OleDbDataReader
Private strUserRole As String = ""
Private strSQL As String = ""

The errors in the message box are as follows:

"No Value given for one or more required parameters."

Thanks for your help thus far.

PS--- I cant find that patch to resolve the virusscan issue other than
manually disabling buffer overrun so if anyone has it or knows
specifically where to get it that would help!

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Oct 16 '06 #11
Ivan Weiss wrote:
PS--- I cant find that patch to resolve the virusscan issue other than
manually disabling buffer overrun so if anyone has it or knows
specifically where to get it that would help!
Patch 5 for McAfee VirusScan Enterprise 8.0i
Direct download for the patch:

http://sdownload.nai.com/products/pr...x/VSE80P05.Zip

Oct 17 '06 #12
Seth,

I am not sure I understand what you are suggesting. I tried hard coding
the values as well as double checking my SQL statement. It is as I want
it.

Wouldnt I want to avoid using a dataset due to memory reasons? I am
only looking to return one record (the roles of the Authenticated user)
as well as confirming they are a real user.

I am unfamiliar with how to access information within a dataset so I
guess I would not know in what direction to go from the sample you sent
me....

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Oct 17 '06 #13
For some reason the OleDb handler is throwing out one of your
parameters (either UserName or Password). The suggestion to hard code
the values, therefore bypassing the parameters. In the event that
failed (which apparently it did) you could use the sample in the link I
provided to add the username and password through oledb parameters. I
gave the link to show how to use parameters, not instructing you to use
a dataset. You should definately still use a datareader to grab the
data. Let me know if that helps.

Thanks,

Seth Rowe
Ivan Weiss wrote:
Seth,

I am not sure I understand what you are suggesting. I tried hard coding
the values as well as double checking my SQL statement. It is as I want
it.

Wouldnt I want to avoid using a dataset due to memory reasons? I am
only looking to return one record (the roles of the Authenticated user)
as well as confirming they are a real user.

I am unfamiliar with how to access information within a dataset so I
guess I would not know in what direction to go from the sample you sent
me....

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Oct 17 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: kajol | last post by:
Hi everyone I am trying to get the content of any webpage (URL) using XMLHTTP, and it is working fine for me, but suddenly I have got a URL "http://www.bizrate.com/" which is causing a system...
3
by: Jason | last post by:
I have two applications that I wrote that use asp and javascript source files. Recently both of these applications starting acting strange on my test box. Image icons will randomly stop showing...
3
by: Don McNamara | last post by:
Hi, I've hit quite a strange problem with XmlSerializer on my W2K3 server. When I serialize/deserialize using an exe on my local computer (XP), everything works fine. When I put the code out on...
9
by: Wescotte | last post by:
Here is a small sample program I wrote in PHP to help illustrates problem I'm having. The data base is using DB2 V5R3M0. The client is WinXP machine using the iSeries Client Access Driver ver...
25
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's...
3
by: Sebastian C. | last post by:
Hello everybody Since I upgraded my Office XP Professional to SP3 I got strange behaviour. Pieces of code which works for 3 years now are suddenly stop to work properly. I have Office XP...
5
by: Simon Verona | last post by:
I have a strange problem with a Windows Forms application. It installs and runs fine on my development machine but consistently comes up with errors on any installed machine. I get an error...
5
by: Ian | last post by:
Hi everyone, I have found some bizarre (to me...!) behaviour of the Form_Activate function. I have a form which has a button control used to close the form and a subform with a datasheet view...
11
by: Mike C# | last post by:
Hi all, I keep getting a strange error and can't pin it down. The message is: This application has requested the Runtime to terminate it in an unusual way. Please contact the application's...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.