错误“没有给出所需参数的值” [英] Error "No value given for required parameter"

查看:96
本文介绍了错误“没有给出所需参数的值”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行以下代码时出现错误没有给出一个或多个必需参数的值错误。我无法找出问题所在。请帮帮我。谢谢。





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.


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++;
                       }
                   }
               }

推荐答案

如果没有您的数据库表定义,我们可以不确定,但我首先检查你的拼写。是 MStaus 真的是列名,或者你应该写的:

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:
OleDbCommand cmd = new OleDbCommand("Select * from Loan where Plan_Id IS NOT NULL AND MStatus IS NULL ", con);


当您收到此错误时,表示Access Engine无法找到您的一个或多个列名称或者整个表格名称正确。



因此请确保您提供的列名与表列名相同。

这是真的是一个列名 MStaus?
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?


这篇关于错误“没有给出所需参数的值”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆