unhandled exception

Samson

New member
Joined
Nov 22, 2006
Messages
2
Programming Experience
1-3
Hello,
My application was working fine. But recently when I run the application its showing this error. Before connecting to database at the login time, it's showing this error. Can any one help me to resolve this error.

An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll

Thank you so much,
Samson.
 
Not just by showing us a rather generic exception like that. We need to see the code. And the error message that you would get from a Try/Catch Block.
 
code here

Hello, its showing at connectionstring. (red font), there is no try/catch block.
Here is the connectionString :
Dim connectionString As String = "provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = D:\KD\kdpro\KDdb.mdb"

in the FrmLogin:

Public Sub CheckLogin()
Dim getLogCond As String
getLogCond = "select * from LoginDets where username='" + Trim(txtuname.Text) + "' And password='" + Trim(txtpwd.Text) + "' and Userstatus=True"
oConn.Open()
Dim selectldtemp As OleDbCommand = New OleDbCommand(getLogCond, oConn)
Dim dr As OleDbDataReader
dr = selectldtemp.ExecuteReader
If (dr.HasRows = True) Then
dr.Read()
logname = dr.Item(1)
utype = dr.Item(3)
dr.Close()
Me.Hide()

If frmMDIMasterFrame Is Nothing Then
frmMDIMasterFrame = New MDIMasterFrame
End If
frmMDIMasterFrame.Show()
oConn.Close()
Else
Beep()
getStatusMsg("Invalid Username or Password")
dr.Close()
oConn.Close()
End If

Thank you so much.
Samson
 
I think you missed my point. There should be a Try/Catch block around the oConn.Open line. Any code that could potentially throw an exception should be protected by a Try/Catch Block.

VB.NET:
Try
oConn.Open()
Catch Ex As Exception
Messagebox.Show(Ex.Message)
End Try

Put that in, and then post what the messagebox says.
 
Try this.... it may provide a little more info than the general exception...
VB.NET:
Try
oConn.Open()
Catch dbEx As OleDbException
Messagebox.Show(dbEx.Message)
Catch Ex As Exception
Messagebox.Show(Ex.Message)
End Try

Sometimes the oledb specific error will have a little more info than the general system exception message.

-tg
 
Back
Top