Problem in generating report (very urgent)
-
- Posts: 70
- Joined: Wed Feb 24, 2010 11:08 am
- Location: India
Problem in generating report (very urgent)
Hi !
I am trying to design a master-detail report using sub reports. I have setup 4 data sources namely student, term1,term2 and term1and2 and setup relations between student and term1, student and term2 , student and term1and2. When i preview the report, i get perfect output but when i run the report in vb code, i get thousands of pages and output is not the one i wanted. I am attaching herewith the report template and part of vb code which i have written to generate the report. I am also attaching the output (in the form of pdf file).
Kindly help me as early as possible.
Thanks in advance.
Naveen
I am trying to design a master-detail report using sub reports. I have setup 4 data sources namely student, term1,term2 and term1and2 and setup relations between student and term1, student and term2 , student and term1and2. When i preview the report, i get perfect output but when i run the report in vb code, i get thousands of pages and output is not the one i wanted. I am attaching herewith the report template and part of vb code which i have written to generate the report. I am also attaching the output (in the form of pdf file).
Kindly help me as early as possible.
Thanks in advance.
Naveen
Re: Problem in generating report (very urgent)
Hello.
You shouldn't register the same dataset several times. It's enough to set all relations in this data set and then to register it in the report.
While you use SQL server, it's better to create sql connection in your report and then you don't need to register any data at all.
Thank you.
You shouldn't register the same dataset several times. It's enough to set all relations in this data set and then to register it in the report.
While you use SQL server, it's better to create sql connection in your report and then you don't need to register any data at all.
Thank you.
-
- Posts: 70
- Joined: Wed Feb 24, 2010 11:08 am
- Location: India
Re: Problem in generating report (very urgent)
Thanks a lot for the reply sir.
I shall be highly thankful, if you can help me more on this issue.
1. As you mentioned "It's enough to set all relations in this data set and then to register it in the report.", kindly let me know, how to do that. I haven't done it so far. I searched the forum also but couldn't find vb.net code for the same.
2. As you have mentioned "While you use SQL server, it's better to create sql connection in your report and then you don't need to register any data at all.", Kindly let me know how can i do that?
I am using vb.net as mentioned earlier.
Thanks in advance.
Naveen
I shall be highly thankful, if you can help me more on this issue.
1. As you mentioned "It's enough to set all relations in this data set and then to register it in the report.", kindly let me know, how to do that. I haven't done it so far. I searched the forum also but couldn't find vb.net code for the same.
2. As you have mentioned "While you use SQL server, it's better to create sql connection in your report and then you don't need to register any data at all.", Kindly let me know how can i do that?
I am using vb.net as mentioned earlier.
Thanks in advance.
Naveen
-
- Posts: 70
- Joined: Wed Feb 24, 2010 11:08 am
- Location: India
Re: Problem in generating report (very urgent)
I have written the following code to set all the relations in the dataset and register the dataset, still the result is same. I am not getting the desired output.
The code goes as follows :
The code goes as follows :
Code: Select all
cmd3.Connection = cn
cmd3.Parameters.Clear()
cmd3.CommandText = "SELECT s.sno, s.sname, s.fname, s.mname, s.admission_no, s.mobile, s.class1, s.section, s.rollno, s.term1_th_total, s.term1_pr_total,s.term1_cce_total, s.yearfrom, s.yearto, s.term1_per, s.term_max, s.term_prac_max, s.cce_max, s.overall_per FROM studentmaster AS s WHERE (s.class1 = @class1) AND (s.yearfrom = @yearfrom) AND (s.section = @section) AND (s.yearto = @yearto) ORDER BY s.sno, s.yearfrom, s.yearto"
cmd3.Parameters.AddWithValue("@class1", class_combo.SelectedValue)
cmd3.Parameters.AddWithValue("@section", section.Text)
cmd3.Parameters.AddWithValue("@yearfrom", Module1.yearfrom)
cmd3.Parameters.AddWithValue("@yearto", Module1.yearto)
cmd4.Connection = cn
cmd4.Parameters.Clear()
cmd4.CommandText = "select * from term1 as a ORDER BY a.SNO, a.YEARFROM, a.YEARTO"
cmd5.Connection = cn
cmd5.Parameters.Clear()
cmd5.CommandText = "select * from term2 as a ORDER BY a.SNO, a.YEARFROM, a.YEARTO"
cmd6.Connection = cn
cmd6.Parameters.Clear()
cmd6.CommandText = "SELECT a.sno, a.subject_code, a.subject_name, a.yearfrom, a.yearto, (a.marks * .5 + a.marks_pr * .5) + a.marks_cce * .5 AS term1_marks, a.absent AS term1_absent, (b.marks * .5 + b.marks_pr * .5) + b.marks_cce * .5 AS term2_marks, b.absent AS term2_absent FROM term1 AS a INNER JOIN term2 AS b ON a.sno = b.sno AND a.subject_code = b.subject_code AND a.yearfrom = b.yearfrom AND a.yearto = b.yearto order by a.sno, a.yearfrom, a.yearto"
ds.Clear()
ds.Tables.Clear()
da.SelectCommand = cmd3
da1.SelectCommand = cmd4
da2.SelectCommand = cmd5
da3.SelectCommand = cmd6
Report.Load(Module1.app_path & "\trial.mrt")
ds.Tables.Add("student")
ds.Tables.Add("term1")
ds.Tables.Add("term2")
ds.Tables.Add("term1and2")
da.Fill(ds, "student")
da1.Fill(ds, "term1")
da2.Fill(ds, "term2")
da3.Fill(ds, "term1and2")
Dim array3() As DataColumn = {ds.Tables(0).Columns("sno"), ds.Tables(0).Columns("yearfrom"), ds.Tables(0).Columns("yearto")}
Dim array4() As DataColumn = {ds.Tables(1).Columns("sno"), ds.Tables(1).Columns("yearfrom"), ds.Tables(1).Columns("yearto")}
Dim array5() As DataColumn = {ds.Tables(2).Columns("sno"), ds.Tables(2).Columns("yearfrom"), ds.Tables(2).Columns("yearto")}
Dim array6() As DataColumn = {ds.Tables(3).Columns("sno"), ds.Tables(3).Columns("yearfrom"), ds.Tables(3).Columns("yearto")}
Dim dr1 As DataRelation = New DataRelation("Relation1", array3, array4)
Dim dr2 As DataRelation = New DataRelation("Relation2", array3, array5)
Dim dr3 As DataRelation = New DataRelation("Relation3", array3, array6)
ds.Relations.Add(dr1)
ds.Relations.Add(dr2)
ds.Relations.Add(dr3)
Report.DataSources.Clear()
Report.Dictionary.Databases.Clear()
Report.RegData(ds)
Report.Dictionary.Synchronize()
Report.Dictionary.Variables.Add("yearfrom", Module1.yearfrom)
Report.Dictionary.Variables.Add("yearto", Module1.yearto)
Report.Compile()
Report.Show(True)
Report.Dictionary.Clear()
ds.Relations.Clear()
ds.Tables("student").Constraints.Clear()
ds.Tables("term1").Constraints.Clear()
ds.Tables("term2").Constraints.Clear()
ds.Tables("term1and2").Constraints.Clear()
ds.Tables.Remove("student")
ds.Tables.Remove("term1")
ds.Tables.Remove("term2")
ds.Tables.Remove("term1and2")
Re: Problem in generating report (very urgent)
Hello.
Thank you.
You can read about relations on the MSDN Library.Naveen Aggarwal wrote:1. As you mentioned "It's enough to set all relations in this data set and then to register it in the report.", kindly let me know, how to do that. I haven't done it so far. I searched the forum also but couldn't find vb.net code for the same.
Please, read the Stimulsoft Reports.Net Developer FAQ.Naveen Aggarwal wrote:2. As you have mentioned "While you use SQL server, it's better to create sql connection in your report and then you don't need to register any data at all.", Kindly let me know how can i do that?
I am using vb.net as mentioned earlier.
Thank you.
-
- Posts: 70
- Joined: Wed Feb 24, 2010 11:08 am
- Location: India
Re: Problem in generating report (very urgent)
Thanks a lot for your reply sir !!
Kindly refer to my previous post. I did go through the MSDN library, read about setting up relations in datasets.
Wrote the code accordingly but result remains the same.
Regards !!
Naveen
Kindly refer to my previous post. I did go through the MSDN library, read about setting up relations in datasets.
Wrote the code accordingly but result remains the same.
Regards !!
Naveen
Re: Problem in generating report (very urgent)
Hello.
Please, send us a sample project for analysis and describe in details what do you need to do.
Thank you.
Please, send us a sample project for analysis and describe in details what do you need to do.
Thank you.