Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I got error "No value given for one or more required parameters" error when executing the following code. i can't find out where is problem. Please help me out. Thanks.


C#
using (OleDbConnection con = new OleDbConnection(ConfigurationManager.AppSettings["connection"]))
               {
                   con.Open();
                   OleDbCommand cmd = new OleDbCommand("Select * from Loan where Plan_Id IS NOT NULL AND MStaus IS NULL ", con);

                   OleDbDataReader dr = cmd.ExecuteReader();
                   while (dr.Read())
                   {
                       plid++;
                       if (dr["PayStatus"].ToString() == "Paid")
                       {
                           mstat++;
                       }
                   }
               }
Posted

Without your DB table definition we can't be sure, but I'd start by checking your spelling. Is MStaus really the column name, or should you have written:
C#
OleDbCommand cmd = new OleDbCommand("Select * from Loan where Plan_Id IS NOT NULL AND MStatus IS NULL ", con);
 
Share this answer
 
Comments
varuncodee 24-Jan-16 5:50am    
ohh!! my mistake.. thank you...
OriginalGriff 24-Jan-16 6:04am    
You're welcome!
When you receive this error it means that the Access Engine is unable to find find one or more of your columns names or the whole table name correctly.

So make sure that the column name you have given is same as table column name.
Is this really a column name MStaus?
 
Share this answer
 

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