No value given for one or more required parameters. WHILE FILLING DATATABLE

You can post your problem related to Microsoft Visual Studio Projects here. We will try our best to help you out.
Sean
Posts:22
Joined:Sat Feb 18, 2017 9:02 am
No value given for one or more required parameters. WHILE FILLING DATATABLE

Post by Sean » Tue Mar 07, 2017 8:21 am

i create a datatable in dataset in degine mode with union query.


query as below

SELECT DateofPickup AS Mdate, Name, Address, PhoneNo, SerialNo, DateofVist, ItemName, DateofPickup, TotalQty, Rateof, OpeningB, Dateofretrun, Retrun, Balance,
TotalDay, NULL AS adv
FROM Report
UNION ALL
SELECT Dateofpay AS Mdate, Name, Address, PhoneNo, SerialNno AS SerialNo, DateofVist, NULL AS ItemName, Dateofpay AS DateofPickup, NULL AS TotalQty, NULL
AS Rateof, NULL AS OpeningB, NULL AS Dateofretrun, NULL AS Retrun, NULL AS Balance, NULL AS TotalDay, Adv
FROM PaymentDetail

when i try to fill this datatable with where condation on page load event then it show error (No value given for one or more required parameters.) without where condation its work fine. code as below.

Dim report As New CrystalReport1
OpenConnect()
Cmd.CommandText = "Select * from RFinal where serialno='" & Form4.SerialNoTextBox.Text & "'"

da.SelectCommand = Cmd
da.Fill(ds, "rfinal")---------error occur here No value given for one or more required parameters
report.SetDataSource(ds)
CrystalReportViewer1.ReportSource = report
dt.Clear()
da.Dispose()
conn.Close()
End Sub

i also try it with parameter

Cmd.CommandText = "Select * from RFinal where serialno=@a"

Cmd.Parameters.AddWithValue("@a", Form4.SerialNoTextBox.Text)

da.SelectCommand = Cmd
da.Fill(ds, "rfinal")---------error occur here No value given for one or more required parameters
report.SetDataSource(ds)

Post Reply