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)