I WROTE A STORE PROCEDURE BY THE NAME OF "PATIENTRECORD". ACTUCLLY, I AM WORKING ON CRYSTAL REPORT USING C# AND ASP.NET. IN THIS REPORT, I WILL GIVE "PATIENT REG CODE" AND THEN THIS REPORT GIVE ME INFORMATION IN THIS FORMAT.
| PATIENT REG CODE | DOCTOR NAME | DATE | PV ID | NAME | ADDRESS | PHONE | TREATMENT | MEDICINE |
IN THIS REPORT , I USED SEVERAL TABLES SUCH AS [CLINIC PATIENT REGISTARTION],[CLINIC DOCTOR],[CLINIC OPD INFO],[CLINIC PV TREATMENTS].
IF I SELECT PATIENT REG CODE FROM DROP DOWN LIST AND THEN PRESS "GENERATE PATIENT HISTORY" BUTTON. THERE IS NO RESULT OF REPORT.

sumaira manzoor hussain khanPosted Feb 8, 2012, 2:20 AM
Abdullah MunshiPosted Feb 8, 2012, 2:12 AM
sumaira manzoor hussain khanPosted Feb 8, 2012, 2:04 AM
exception occur in clinic dst.xsd
sumaira manzoor hussain khanPosted Feb 8, 2012, 1:51 AM
yes . my db file.
sumaira manzoor hussain khanPosted Feb 8, 2012, 1:14 AM
sumaira manzoor hussain khanPosted Feb 8, 2012, 1:12 AM
CAN U SENT ME .RAR FILE OF THIS CODE.
Pravin GhadgePosted Feb 7, 2012, 8:50 PM
Iam trying to restore ur db backup in my Sql 2008 server bt iam getting foll error:
"Error when restoring: There is already an object named sysnsobjs in the database."
Abdullah MunshiPosted Feb 7, 2012, 11:37 AM
{
//Conn.open();
int regcode=Convert.ToInt32(DropDownList_patient_reg_code.SelectedValue.ToString());
// patient_emr rpt = new patient_emr(); // It is a Crystal Report Which you made in the 2nd Step
SqlDataAdapter da = new SqlDataAdapter();
// DataSet dst = new DataSet();
clinic_dst dst = new clinic_dst();
DataTable ds = new DataTable();
SqlCommand cmd = new SqlCommand("patientrecord",connection.get());
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add("@patient_regcode",SqlDbType.Int).Value=regcode;// DropDownList_patient_reg_code.SelectedValue.ToString();
da.SelectCommand = cmd;
da.Fill(dst);
//CrystalReportViewer_patientrecord.ReportSource= rpt;
dst.WriteXmlSchema("clinic_dst.xsd");
DisplayReport(CrystalReportViewer_patientrecord, dst, Server.MapPath("patient_emr.rpt"));
}
public void DisplayReport(CrystalReportViewer crv, DataSet ds, String reportname)
{
ReportDocument rptdoc = new ReportDocument();
rptdoc.Load(reportname);
rptdoc.SetDataSource(ds);
crv.ReportSource = rptdoc;
crv.DataBind();
}
Execute this code first time.
After that comment this line ---- " dst.WriteXmlSchema("clinic_dst.xsd"); "
And then run your code.
At present the data is not displayed as there are no columns in the datatable in the "clinic_dst.xsd" dataset.
Also check this .aspx code
sumaira manzoor hussain khanPosted Feb 7, 2012, 10:53 AM
this is my appli and db backup
sumaira manzoor hussain khanPosted Feb 7, 2012, 10:45 AM
Pravin GhadgePosted Feb 7, 2012, 10:41 AM
so i will better help u.
sumaira manzoor hussain khanPosted Feb 7, 2012, 10:38 AM
your querry perfectly execute in querry analyzer . but one record comming many time. i just right this query "timeexec patientrecord '0001'"
Pravin GhadgePosted Feb 7, 2012, 10:19 AM
have u checked my query in ur Sql query analyzer.
Plz execute foll line in query analyzer:
exec patientrecord '0001' (for eg:assume '0001' is [patient reg code] . plz replce with appropriate value)
& Check whether it is showing some result or not.
sumaira manzoor hussain khanPosted Feb 7, 2012, 6:49 AM
THE PROBLEM OF NAMESPACE HAS BEEN SOLVED. BUT AGAIN CRYSTAL REPORT DOES NOT GENERATE OUTPUT. I AM SENDING MY CODE N STORE PROCEDURE N CRYSTAL REPORT WEB FORM.
THANKS IN ADVANCE FOR MY HELP.
REGARDS
SUMAIRA MANZOOR
Abdullah MunshiPosted Feb 7, 2012, 5:15 AM
using CrystalDecisions.Web;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
sumaira manzoor hussain khanPosted Feb 7, 2012, 4:30 AM
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
sumaira manzoor hussain khanPosted Feb 7, 2012, 4:26 AM
Error 1:
The type or namespace name 'CrystalReportViewer' could not be found (are you missing a using directive or an assembly reference?)
Abdullah MunshiPosted Feb 7, 2012, 3:53 AM
protected void Button_generate_report_Click(object sender, EventArgs e)
{SqlDataAdapter da = new SqlDataAdapter();
DataTable ds = new DataTable();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "patientrecord"; // This is the Procedure name which we have created
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add("@patient_regcode",SqlDbType.Int).Value = DropDownList_patient_reg_code.Text;
cmd.Connection = connection.get();
cmd.CommandType = System.Data.CommandType.StoredProcedure;
da.SelectCommand = cmd;
da.Fill(ds);
DisplayReport(CrystalReportViewer1, ds, Server.MapPath("xyz.rpt"))
}
public void DisplayReport(CrystalReportViewer crv , DataSet ds , String reportname)
{
ReportDocument rptdoc = new ReportDocument();
rptdoc.Load(reportname);
rptdoc.SetDataSource(ds);
crv.ReportSource = rptdoc ;
crv.DataBind();
}
==========
sumaira manzoor hussain khanPosted Feb 7, 2012, 3:39 AM
Abdullah MunshiPosted Feb 7, 2012, 2:54 AM
Once you have filled the dataset using adapter you can call this function.
public void DisplayReport(CrystalReportViewer crv , DataSet ds , String reportname)
{
ReportDocument rptdoc = new ReportDocument();
rptdoc.Load(reportname);
rptdoc.SetDataSource(ds);
crv.ReportSource = rptdoc ;
crv.DataBind();
}
=====================
Call it like,
DisplayReport(CrystalReportViewer1, ds, Server.MapPath("xyz.rpt"))
I hope this will work.
sumaira manzoor hussain khanPosted Feb 7, 2012, 2:53 AM
i used inner join in this store procedures
sumaira manzoor hussain khanPosted Feb 7, 2012, 2:52 AM
ASSALAM-O-ALIKUM SIR;
i write this store procedure in my query analyzer sql 2000 then after the command give this msg " The command(s) completed successfully." now this is my store procedure n the below.
ALTER procedure [dbo].patientrecord
@patient_regcode int
as
begin
select [clinic patient registartion].[patient reg code],[clinic patient registartion].[patient name],
[clinic patient registartion].address,
[clinic patient registartion].[phone no],[clinic opd info].[pv id],
[clinic doctor].[name],[clinic pv treatments].[treatment id] from [clinic patient registartion],[clinic opd info],[clinic doctor],[clinic pv treatments] where [clinic patient registartion].[patient reg code]=@patient_regcode
end
regards
sumaira
sumaira manzoor hussain khanPosted Feb 7, 2012, 1:21 AM
actually i am sending "patient reg code" through "drop down list box" .in which place in my code i will put dropdown list. secondly , u saw my table in the post, am i writing correct store procedure. i means , i am fetching data from multiple tables . this store procedure correct for this scenario.
please bhai, help me. because this problem irritate to from i week.
thanks
regards
sumaira
Pravin GhadgePosted Feb 5, 2012, 12:17 PM
have u checked ur stored procedure working properly in Sql Management studio.
In Sql Management studio, run foll query:
exec patientrecord '0001'
(for eg:0001 is ur 'patient_regcode' parameter. Plz enter valid value in place of '0001')
Then check that this query gives u result or not
Plz let me know.
sumaira manzoor hussain khanPosted Feb 5, 2012, 1:18 AM
YES, I HAVE ERROR IN MY CODE. BUT WHCIH TYPE OF ERROR IN MY CODE.
REGARDS,
SUMAIRA MANZOOR
Pravin GhadgePosted Feb 4, 2012, 10:16 AM
r u getting some error?