Click here to Skip to main content
15,899,314 members

Comments by Member 13505603 (Top 7 by date)

Member 13505603 6-Dec-19 14:32pm View    
Thank you Aung ,
the solution working now the error of show blank screen after publish was the SAP crystal reports runtime engine , I installed runtime engine for crystal reports then I copied the folder aspnet_client under mr site root folder
Member 13505603 6-Dec-19 0:31am View    
I tried this now no errors but when i click the button its not show the report :


SqlCommand cmd = new SqlCommand("GET_ORDER_RESULT_PRINT_CASH", cn);
cmd.Parameters.AddWithValue("@ORDER_ID",Convert.ToInt32(TXTORDERID.Text));
cmd.Parameters.AddWithValue("@deptid",Convert.ToInt32(TXTDEPTID.Text));
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.SelectCommand.CommandType = CommandType.StoredProcedure;
DataTable dt = new DataTable();
sda.Fill(dt);


ReportDocument reportDocument1 = new ReportDocument();
reportDocument1.Load(Server.MapPath("~/RPT/RPT_CASH_RESULT.rpt"));
reportDocument1.SetDataSource(dt);
CrystalReportViewer1.ReportSource = reportDocument1;
var connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "dba";
connectionInfo.DatabaseName = "DBA";
connectionInfo.Password = "DBA";
connectionInfo.UserID = "DBA";
connectionInfo.Type = ConnectionInfoType.SQL;
connectionInfo.IntegratedSecurity = false;
for (int i = 0; i < CrystalReportViewer1.LogOnInfo.Count; i++)
{
CrystalReportViewer1.LogOnInfo[i].ConnectionInfo = connectionInfo;
}
Member 13505603 5-Dec-19 23:40pm View    
Thank you sir for helping me
I changed it but still have same error
Procedure or function 'GET_ORDER_RESULT_PRINT_CASH' expects parameter '@ORDER_ID', which was not supplied.
in the line
sda.Fill(dt);

can i make link between datatable and parameters in sda.fill ?
Member 13505603 29-Nov-19 1:11am View    
I changed the code but getting now new error :
protected void BtnCrystal_Click(object sender, EventArgs e)
{
if (Session["patientno"] != null && Convert.ToInt32(Session["patientno"]) > 0)
{

SqlCommand cmd = new SqlCommand("GET_ORDER_RESULT_PRINT_CASH", cn);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);

ReportDocument reportDocument1 = new ReportDocument();
reportDocument1.Load(Server.MapPath("~/RPT/RPT_CASH_RESULT.rpt"));
reportDocument1.SetDatabaseLogon("DBA", "1111");
reportDocument1.SetParameterValue("@ORDER_ID", TXTORDERID.Text);
reportDocument1.SetParameterValue("@deptid", TXTDEPTID.Text);

reportDocument1.SetDataSource(dt);
CrystalReportViewer1.ReportSource = reportDocument1;
CrystalReportViewer1.DataBind();

var connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "SQL";
connectionInfo.DatabaseName = "DB";
connectionInfo.Password = "1111";
connectionInfo.UserID = "DBA";
connectionInfo.Type = ConnectionInfoType.SQL;
connectionInfo.IntegratedSecurity = false;
for (int i = 0; i < CrystalReportViewer1.LogOnInfo.Count; i++)
{
CrystalReportViewer1.LogOnInfo[i].ConnectionInfo = connectionInfo;
}
}

when click the button its giving the following error now Additional information: Procedure or function 'GET_ORDER_RESULT_PRINT_CASH' expects parameter '@ORDER_ID', which was not supplied , I already added the parameters where is the error ?
Member 13505603 28-Nov-19 23:51pm View    
Deleted
For me i am using stored procedure and passing parameters to crystal reports how to set the data source for stored procedure from the example you give ?
this is my stored procedure :

ALTER proc [dbo].[GET_ORDER_RESULT_PRINT_CASH]
@ORDER_ID int,
@deptid int
as
SELECT * FROM (
SELECT [LAB_RESULTS].ORDER_ID as 'order number'
,labtests.TestId as 'Test Id'
,labtests.TestName as 'Test Name'
,NORMAL_RESULT as 'Normal'
,APPROVED_DATE as 'Report Date'
,CASE WHEN coalesce([RESULT_NUMBER],'') <> '' THEN RESULT_NUMBER WHEN coalesce(RESULT_REPORT, '') <> '' THEN RESULT_REPORT END AS Result
,[RESULT_NOTE] as 'Notes'
,TestsRanges.LowerLimit as 'Low Range'
,TestsRanges.UpperLimit as 'High Range'
,TestsRanges.panic_value as 'Panic'
,TestsRanges.text_range as 'Text Range'
,LAB_RESULTS.CUSTID as 'Customer No'
,Customers.CustName as 'Customer Name'
,LAB_RESULTS.patient_no as 'Patient No'
,Patients.PATIENT_NAME as 'Patient Name'
,LAB_RESULTS.REQ_FORM_NO as 'REQ. FORM NO.'
,null as 'Category'
,Patients.Age AS 'AGE'
,gender.gendername as 'SEX'
,labtests.TestNotes as 'Test Note'
,TestsUnits.UnitName as 'UNIT'
,LAB_RESULTS.deptid AS 'DEPTID'
,Lab_Hematology_Samples.COLLECTION_DATE as 'Collection Date'
,Lab_Hematology_Samples.RECEIVING_DATE as 'Receiving Date'
,null AS 'Group Name'
,LAB_RESULTS.SERIAL
,LAB_RESULTS.GROUPID
,LAB_RESULTS.packageid
,LAB_RESULTS.EXAMINED_BY
,LAB_RESULTS.APPROVED_BY
,LAB_RESULTS.UPDATED_BY
,LAB_RESULTS.UPDATED_DATE

FROM [dbo].[LAB_RESULTS]
inner join LabTests on LabTests.testid=LAB_RESULTS.TESTID
inner join TestsRanges on TestsRanges.TestId = LAB_RESULTS.TESTID
inner join Customers on Customers.CustId=LAB_RESULTS.CUSTID
inner join patients on Patients.Patient_No = LAB_RESULTS.patient_no
inner join machines on lab_results.machine_id = machines.machine_id
inner join gender on gender.genderid = Patients.Gender
inner join TestsUnits on TestsUnits.UnitId = LabTests.UnitId
inner join Lab_orders_Cash on Lab_orders_Cash.cash_order_id = LAB_RESULTS.ORDER_ID
inner join PatientCat on (patientcat.CatId = Lab_orders_Cash.CatId)
inner join Lab_Hematology_Samples on Lab_Hematology_Samples.SAMPLE_ID = LAB_RESULTS.SAMPLE_ID
inner join Groups on (Groups.groupid = LAB_RESULTS.GROUPID and Groups.Testid = LAB_RESULTS.TESTID )

where lab_results.ORDER_ID = @ORDER_ID
and (Lab_orders_Cash.catid = TestsRanges.CatId )
and LAB_RESULTS.EXAMINED_DATE is not null
and LAB_RESULTS.APPROVED_DATE is not null
and LAB_RESULTS.update_count in (select max(update_count) from LAB_RESULTS where SAMPLE_STATUS = 6 and deptid = @deptid and ORDER_ID = @ORDER_ID)
and LAB_RESULTS.SAMPLE_STATUS = 6
and LAB_RESULTS.deptid = @deptid
AND TestsRanges.machine_id = LAB_RESULTS.machine_id
and (Patients.Gender = TestsRanges.PatientSex or TestsRanges.PatientSex = 1 )

UNION ALL

SELECT
[LAB_RESULTS].ORDER_ID as 'order number'
,labtests.TestId as 'Test Id'
,labtests.TestName as 'Test Name'
,NORMAL_RESULT as 'Normal'
,APPROVED_DATE as 'Report Date'
,CASE WHEN coalesce([RESULT_NUMBER],'') <> '' THEN RESULT_NUMBER WHEN coalesce(RESULT_REPORT, '') <> '' THEN RESULT_REPORT END AS Result
,[RESULT_NOTE] as 'Notes'
,TestsRanges.LowerLimit as 'Low Range'
,TestsRanges.UpperLimit as 'High Range'
,TestsRanges.panic_value as 'Panic'
,TestsRanges.text_range as 'Text Range'
,LAB_RESULTS.CUSTID as 'Customer No'
,Customers.CustName as 'Customer Name'
,LAB_RESULTS.patient_no as 'Patient No'
,Patients.PATIENT_NAME as 'Patient Name'
,LAB_RESULTS.REQ_FORM_NO as 'REQ. FORM NO.'
,patientcat.CatName as 'Category'
,Patients.Age AS 'AGE'
,gender.gendername as 'SEX'
,labtests.TestNotes as 'Test Note'
,TestsUnits.UnitName as 'UNI