“没有给出一个或多个必需参数的值”错误

时间:2017-03-27 14:07:17

标签: vb.net ms-access-2010

我正在写一个应用程序而且我收到了这个错误:

  

没有给出一个或多个必需参数的值

代码:

DA = New OleDbDataAdapter("select  TBL_BARANG as [Kode],Nama_BARANG as [Nama],Harga_Beli as [Harga Beli],Harga_Jual as [Harga Jual],Jumlah_BARANG as [Stok],Satuan_BARANG as [Satuan] From TBL_BARANG", CONN)
DS = New DataSet
DA.Fill(DS, "TBL_BARANG")
DGV.DataSource = DS.Tables("TBL_BARANG")
DGV.ReadOnly = True

2 个答案:

答案 0 :(得分:0)

如@Bugs所述,此查询的代码应如下所示:

DA = New OleDbDataAdapter("SELECT Nama_BARANG as [Nama], Harga_Beli as [Harga Beli], Harga_Jual as [Harga Jual], Jumlah_BARANG as [Stok], Satuan_BARANG as [Satuan] From TBL_BARANG", CONN)
DS = New DataSet
DA.Fill(DS, "TBL_BARANG")
DGV.DataSource = DS.Tables("TBL_BARANG")
DGV.ReadOnly = True

答案 1 :(得分:0)

从查询中删除别名,如下所示...

选择TBL_BARANG,Nama_BARANG,Harga_Beli,Harga_Jual,Jumlah_BARANG ,Satuan_BARANG来自TBL_BARANG