没有给出一个或多个require参数的值 [英] No value given for one or more require parameter

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

问题描述

Hello Guys,我正面临一个问题,我不知道为什么我会收到此错误以及如何解决它请指导我如何做到这一点

i我收到数据时收到错误在datagridview



我尝试过:



Hello Guys, i am facing a issue and i dont know why i am getting this error and how to solve it please guide me how can i do this
i am getting error when i am get data in datagridview

What I have tried:

string query = "Select Product_Name As [ProductName],COUNT(ProductName) As [Qty],SUM(Price) As [Price] FROM [Sales Record] GROUP BY [Product Name]";
 using (OleDbConnection conn = new OleDbConnection(connStr))
 {
     using (OleDbDataAdapter adapter = new OleDbDataAdapter(query, conn))
     {
         conn.Open();
         DataSet ds = new DataSet();
         if (ds != null)
         {

             adapter.Fill(ds);

             dataGridView1.DataSource = ds.Tables[0];
             conn.Close();
             dataGridView1.Rows[1].Visible = false;
             dataGridView1.Columns[0].Width = (150);
             dataGridView1.Columns[1].Width = (275);
             dataGridView1.Columns[2].Width = (250);
         }
     }
 }

推荐答案

此错误表示:您正在尝试获取数据库表中不存在的字段



请检查您的SQL。



This error means: You are trying to fetch a field which doesn't exist in your database table.

please check your SQL.

string query = "Select Product_Name As [ProductName],COUNT(ProductName) As [Qty],SUM(Price) As [Price] FROM [Sales Record] GROUP BY [Product Name]";



您创建了 Product_Name的别名为[ProductName] ,然后您尝试将该ProductName计为数量,我认为这句话对我来说是可疑的.. :-)

请查看您的表格字段名称。


you create alias of Product_Name as [ProductName] and after that you are trying to count that ProductName as quantity, I think this statement are suspicious to Me..:-)
Please check with your Table Fields name.


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

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