Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
when ever run my program i get the below exception.
Exception thrown: 'System.Data.OleDb.OleDbException' in System.Data.dll
at
System.Data.OleDb.OleDbCommand.Execute.ExecuteCommandTextErrorHandling(OleDbHResulthr)
at
System.Data.OleDb.OleDbCommand.Execute.ExecuteCommandTextForSingleResult(tagDBPARAMSdbParams,Object&executeResult)
at
 System.Data.OleDb.OleDbCommand.Execute.ExecuteReade(Command Behavior beehavior,String method)
at
System.Data.OleDb.OleDbCommand.ExecuteReadder(CommandBehavior behavior)
at
line 60
and line 60 =  rdr = cmd.ExecuteReader()


I'm using below code:
VB
con = New OleDbConnection(cs)
            con.Open()
            Dim ct As String = "select Allowances,BasicSalary,CashBenefits,VehicleFuelDriver,VehicleFuel,vehicleOnly,FuelOnly,AccomodationFurnishing,AccomodationOnly,SharedAccomodation,AgeDependency,MarriageResponsibilities,Disabled,OldAge,ChildEducation,TrainingCost,Tier3contribution,NoChildren,LifeInsurance,SSN,NoOfDependents from EmployeeRegistration where EmployeeName=@find"
            cmd = New OleDbCommand(ct)
            cmd.Connection = con
            cmd.Parameters.Add(New OleDbParameter("@find", OleDbType.VarChar, 30, "EmployeeName"))
            cmd.Parameters("@find").Value = Trim(employeenamecmbbx.Text)
            rdr = cmd.ExecuteReader()
Posted
Updated 6-Jan-16 3:54am
v3
Comments
dan!sh 6-Jan-16 3:57am    
There must be more details in the exception. Message, inner exception etc. Have you checked that?
Masta Pee 6-Jan-16 3:59am    
okay i will post the entire exception,
OriginalGriff 6-Jan-16 4:16am    
Please do, and include the relevant code fragments so we can see exactly what caused it.

Use the "Improve question" widget to edit your question and provide better information.
Masta Pee 6-Jan-16 7:18am    
i have updated the question..
OriginalGriff 6-Jan-16 7:21am    
:sigh:
And the code looks like?
Just the one line:
rdr = cmd.ExecuteReader()
tells us nothing - we need to see what the "setup" code fro that is - the command, the connection, the parameters. In isolation, that line tells us nothing except that you are using a DataReader.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900