I made a small mistake which costed me a lot of time.
1) When you pull the data from dataset, we create a temp table to save that (Which i did not do)
2) We need to pass the datatable (Temp Table in this case) to show the information.(Which i did not do)
After taking care of these two things, My App started showing the correct data.
I am posting the code modified also for reference.
Private Sub Generate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Generate.Click
Dim Gentxt As Integer = TxtOrderID.Text
Dim SQLGEN As New SqlCommand
Dim cryRpt As New GenRep
Dim RetPath As String = Path.GetDirectoryName(Application.ExecutablePath)
Dim sqlLink = New SqlConnection()
sqlLink.ConnectionString = ConStr
Try
Dim ds As datatable = GetData()
cryRpt.Load("F:\Projects\2008 Projects\Test Application\Test Application\Genrep.rpt")
cryRpt.SetDataSource(dt)
ReportViewer.ReportSource = cryRpt
ReportViewer.Refresh()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Function GetData() As DataSet
Dim Query As String = "SELECT [ORDERID],[USERNAME],[ORDERDATE],[PRODUCT],[SUPPLYDATE],[SUPPLYQUAN],[TOTSUPPLY],[AMTPAID],[TAKENBY] FROM TESTDATA "
If TxtOrderID.Text <> "" Then
Query += "WHERE ORDERID = " & TxtOrderID.Text & ""
End If
Dim Sqlcon As New SqlConnection
Sqlcon.ConnectionString = ConStr
Dim sqlda As New SqlDataAdapter(Query, Sqlcon)
Dim DS As New testdataDataSet
sqlda.Fill(DS)
Dim dt As DataTable = DS.Tables("Temp Table")
Return dt
End Function
And this worked...
Thanks for your reply guys...