Please help my rdlc reports comes out empty yet there is data in the table please help.
Private Function GetData() As DataTable
Dim classrd As String = Request.QueryString("class")
Dim intaked As String = Request.QueryString("intake")
Dim fromsd As DateTime = Request.QueryString("From")
Dim Tosd As DateTime = Request.QueryString("Tosd")
Dim dt As New DataTable()
'create a new DateTable ,used to store the table from DB.
Dim conString As String = ConfigurationManager.ConnectionStrings("INTERVIEWSConnectionString").ConnectionString
Using con As New SqlConnection(conString)
' Dim con As New SqlConnection(conn)
'establish the table to DataBase
Dim cmd As New SqlCommand("Runclasscontrol", con)
'pass the parameter in sql command which is a stored procedure name in your DB.
cmd.CommandType = CommandType.StoredProcedure
'command type is stored procedure type.
Dim idatefro As String = DateTime.Parse(fromsd).ToString("dd/MM/yyyy", CultureInfo.InvariantCulture)
Dim idateto As String = DateTime.Parse(Tosd).ToString("dd/MM/yyyy", CultureInfo.InvariantCulture)
cmd.Parameters.AddWithValue("@c", classrd)
cmd.Parameters.AddWithValue("@it", intaked)
cmd.Parameters.Add("@f", SqlDbType.DateTime).Value = idatefro
'add the parameter and its type ,which are from date from textbox .
cmd.Parameters.Add("@t", SqlDbType.DateTime).Value = idateto
'add the parameter and its type ,which are to date from textbox .
Dim adt As New SqlDataAdapter(cmd)
'pass the cammond to the sqlDataAdapter as a parameter
adt.Fill(dt)
'fill the fetched data to the data table.
Return dt
' return the Data Table.
End Using
End Function
Private Sub Report()
'Dim dt As DataTable = GetData(DateTime.Parse(txtFrom.Text), DateTime.Parse(txtTo.Text))
' Try
ReportViewer1.ProcessingMode = ProcessingMode.Local
Dim fee As String = Request.QueryString("formfee")
Dim classr As String = Request.QueryString("class")
Dim intake As String = Request.QueryString("intake")
Dim froms As String = Request.QueryString("From")
Dim Tos As String = Request.QueryString("Tos")
Dim dt As DataTable = GetData()
'calls the GetDate function which receives the from date and todate ,which are fetched from textboxs.
Dim dt2 As DataTable = GetSPResult2022()
Dim rds As New ReportDataSource("DataSet1", dt)
'load the dataset and the datatable to reportDataSource.
ReportViewer1.Visible = True
'bind the reportDataSource with the report.
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/Collectionsdata.rdlc")
Dim rpt As ReportParameter() = New ReportParameter() {New ReportParameter("From", froms), New ReportParameter("To", Tos), New ReportParameter("Fee", fee)}
'just to display in textboxes from date and to date ,pass the parameters .
'Note:the first parameter of the ReportParameter() should be same as parameter in the report.rdlc
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.SetParameters(rpt)
ReportViewer1.LocalReport.DataSources.Add(rds)
ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WebForms.ReportDataSource("DataSet2", dt2))
ReportViewer1.LocalReport.Refresh()
' Catch ex As Exception
'End Try
End Sub
store procedure
PROCEDURE [dbo].[Runclasscontrol] @c nvarchar(50),@it nvarchar(50),@f nvarchar(50), @t nvarchar(50)AS
SELECT account,avgs2,Emarksdate,status, taken, stream,fno,upper(Name) as name , student.Class, student.Intake, student.Category, student.Maths, student.Eng, student.date, ([maths]+[eng])/2 AS Average, student.Username,avgs,username,usernamemarks,Left([Name],1) as Letter,id
FROM student
WHERE (((student.Class)=@c) AND ((student.Intake)=@it)) and (status IS NULL) and ([entry] BETWEEN CONVERT(datetime,@f,103) AND CONVERT(datetime,@t,103))
ORDER BY class,student.Name, [maths]+[eng]/2 DESC;
DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
Finance.aspx
HTML1300: Navigation occurred.
Finance.aspx
DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
Finance.aspx