crystal report for student mark list [Resolved]

Posted by Shamseena under Others on 11/7/2012 | Points: 10 | Views : 2806 | Status : [Member] | Replies : 3
Hi all,

I have to create student marklist report.The report shoulb be like below..


Same report need 3 subheading as


1. Passed Student List ( Passed in all subject)

2. Resit Student List (Failed in 3 0r less subject)

3. Failed Student List (Failed in 4 or more Subject)






SLNo StudentName English Arabic Maths Biology



Passed Student List


1 Ram 67 80 98 56

2 Radha 78 75 56 75


Resit student List

1 leela 43 60 32 72

2 Sajan 67 24 55 69


Failed Student List

1 karan 43 12 24 14



How to design this crystal report and how to apply the already developed sql query for the above condition to create this report.Please help me to solve this problem..


Thanks in advance

Shamsi




Responses

Posted by: Rajesh081725 on: 11/8/2012 [Member] Bronze | Points: 50

Up
0
Down

Resolved
I will show you simple report creation process with screenshots. A picture is worth more than a thousand words, so I always believe in an article with screenshots.

Let's start by creating a new website in VS2010. See the following screen:

http://www.codeproject.com/Articles/166291/Generate-a-report-using-Crystal-Reports-in-Visual
http://www.c-sharpcorner.com/UploadFile/mahesh/CrystalReportsIntroduction11082005014959AM/CrystalReportsIntroduction.aspx


using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;Below is the final code for reports:

Collapse | Copy Codeprotected void Page_Load(object sender, EventArgs e)
{
ReportDocument rptDoc = new ReportDocument();
dsSample ds = new dsSample(); // .xsd file name
DataTable dt = new DataTable();

// Just set the name of data table
dt.TableName = "Crystal Report Example";
dt = getAllOrders(); //This function is located below this function
ds.Tables[0].Merge(dt);

// Your .rpt file path will be below
rptDoc.Load(Server.MapPath("../Reports/SimpleReports.rpt"));

//set dataset to the report viewer.
rptDoc.SetDataSource(ds);
CrystalReportViewer1.ReportSource = rptDoc;
}

public DataTable getAllOrders()
{
//Connection string replace 'databaseservername' with your db server name
string sqlCon = "User ID=sa;PWD=sa; server=databaseservername;INITIAL CATALOG=SampleDB;" +
"PERSISTSECURITY INFO=FALSE;Connect Timeout=0";
SqlConnection Con = new SqlConnection(sqlCon);
SqlCommand cmd = new SqlCommand();
DataSet ds = null;
SqlDataAdapter adapter;
try
{
Con.Open();
//Stored procedure calling. It is already in sample db.
cmd.CommandText = "getAllOrders";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = Con;
ds = new DataSet();
adapter = new SqlDataAdapter(cmd);
adapter.Fill(ds, "Users");
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
cmd.Dispose();
if (Con.State != ConnectionState.Closed)
Con.Close();
}
return ds.Tables[0];
}


Time is Gold
Thanks & Regards,
Rajesh Kumar,
9962038582.

Shamseena, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajesh081725 on: 11/8/2012 [Member] Bronze | Points: 25

Up
0
Down
hai shamsi,
if its satisfied select mark as answer

Time is Gold
Thanks & Regards,
Rajesh Kumar,
9962038582.

Shamseena, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shamseena on: 11/8/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Rajesh,

The crystal report basic things and connections are ok.But As per my requirment i need more information.I already created the sql query for the above 3 conditions.How can I apply this sql query to crystal report for creating 3 groups as above ??

Shamseena, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response