Hi I written a code but it is throwing error.
{
connection.Open();
SqlDataAdapter adapter = null;
DataSet dataSet = new DataSet();
StiReport report1 = new StiReport();
string sql1 = "Select patient_id,last_name from patient where patient_id=175";// (192.168.0.101)
[Select patient_id,last_name from patient where patient_id=@patientID] // This is written in Design time for (192.168.0.100).
adapter = new SqlDataAdapter(sql1, connection);
adapter.Fill(dataSet);
string appDirectory = HttpContext.Current.Server.MapPath("~/");
report1.Load(appDirectory + "\\PatientTrail.mrt");
dataSet.Tables[0].TableName = "patients";
report1.DataSources.Clear();
report1.Dictionary.Databases.Clear();
report1.RegData("DataSource", dataSet.Tables["patients"]);
report1.Dictionary.Synchronize();
report1.Render(false); // HERE I GETTING THE ERROR.
StiWebViewer1.Report = report1;
StiWebViewer1.Visible = true;
}
I want to know how to design a report using local database server connection(192.168.0.100), later in the code I want to connect to some other database server connection(192.168.0.101).
Is it possible ?
Please tell me as early as possible.
For the above code the following error I'm getting.
THE NAME 'DataSource1' DOES NOT EXIST IN THE CURRENT CONTEXT.
How do create a report using code for different data sources
-
- Posts: 2
- Joined: Sat Dec 03, 2011 5:49 am
- Location: Bangalore,India
How do create a report using code for different data sources
- Attachments
-
- 1468.eRROr.png (39.49 KiB) Viewed 3237 times
Thank you.
How do create a report using code for different data sources
Hello.
Please, try to reg Data Source with next code:
If there are still any problems, please, send us your project and describe your problem more detailed.
Thank you.
Please, try to reg Data Source with next code:
Code: Select all
report1.RegData("DataSource1", dataSet.Tables["patients"]);
Thank you.
-
- Posts: 2
- Joined: Sat Dec 03, 2011 5:49 am
- Location: Bangalore,India
How do create a report using code for different data sources
Hi,
Thank you very much for your reply..!
I Have a great problem, As I want to create a report in XAML.cs page using using LINQ, is it possible?.
I searched in the net many times but I didn't get the solution properly.
I've the license for following DLL's:
Stimulsoft.Base.SL
Stimulsoft.Control.SL
Stimulsoft.Report.SL
Stimulsoft.Report.SLDesighn
Stimulsoft.Report.Viewer.SL
I want to create in this way 'Create Report in Native Silverlight (Only Silverlight Client)':
1. How to create Report.cs file using LINQ Source from database.
2. How can i assign the data source(LINQ query result) to the Report.cs, which is coming from the sql database.
3. What the steps to follow.
Can you send the clear information please.
This is my linq code in domain service code:
I can get the result in and Object, Lets tell me the steps please.
Finally i want open the result in directly in PDF FILE. No need to display in Report Viewer.
Thank you very much for your reply..!
I Have a great problem, As I want to create a report in XAML.cs page using using LINQ, is it possible?.
I searched in the net many times but I didn't get the solution properly.
I've the license for following DLL's:
Stimulsoft.Base.SL
Stimulsoft.Control.SL
Stimulsoft.Report.SL
Stimulsoft.Report.SLDesighn
Stimulsoft.Report.Viewer.SL
I want to create in this way 'Create Report in Native Silverlight (Only Silverlight Client)':
1. How to create Report.cs file using LINQ Source from database.
2. How can i assign the data source(LINQ query result) to the Report.cs, which is coming from the sql database.
3. What the steps to follow.
Can you send the clear information please.
This is my linq code in domain service code:
Code: Select all
public IQueryable GetPatientCoPayDetails(int appointmentId, string receivedBy)
{
var query = from a in this.ObjectContext.appointments
join p in this.ObjectContext.patients on a.patient_id equals p.patient_id into PatientValues
from ojp in PatientValues.DefaultIfEmpty()
join ph in this.ObjectContext.physicians on ojp.default_physician equals ph.physician_id into PhValues
from oph in PhValues.DefaultIfEmpty()
join u in this.ObjectContext.users on oph.user_id equals u.user_id into usValues
from us in usValues.DefaultIfEmpty()
join f in this.ObjectContext.facilities on ojp.default_facility equals f.facility_id into facValues
from fac in facValues.DefaultIfEmpty()
join pr in this.ObjectContext.Practices on fac.practice_id equals pr.practice_id into OJValues
from oj in OJValues.DefaultIfEmpty()
where a.appointment_id == appointmentId
select new CustomFormattedCoPayReceipt
{
patient_name = "Received from " + ojp.last_name + " " + ojp.first_name + ", amount of US$ ", //+ (a.co_pay_amount == null ? 0 : a.co_pay_amount) + "/- for out-patient consultation with "+"Dr. "+u.last_name+" "+u.first_name+" on "+a.date_created+" appointment.",
coPay_amount = (int)a.co_pay_amount,
physician_name = "/- for out-patient consultation with " + "Dr. " + us.last_name + " " + us.first_name + " on ",
facility_name = fac.facility_name,
facility_address = fac.address_line_1 + ", " + fac.City + ", " + fac.state_code + ", " + fac.zip_code,
facility_phone = "Phone: " + (fac.main_phone == null ? "_" : fac.main_phone) + " Fax: " + (fac.Fax == null ? "_" : fac.Fax) + " E: " + (fac.email == null ? "_" : fac.email),
//facility_fax=fac.Fax,
//facility_email=fac.email,
appointmentId = a.appointment_id == null ? 0 : a.appointment_id,
appointment_date = a.date_created,
//physician_id=ph.physician_id,
//payment_method="Payment Method: "+(a.payment_method==null? "_":a.payment_method),
received_by_user = "Received by: " + receivedBy
};
return query;
}
Finally i want open the result in directly in PDF FILE. No need to display in Report Viewer.
Thank you.
How do create a report using code for different data sources
Hello,
Please see the sample code for using LINQ as datasource:
Thank you.
Please see the sample code for using LINQ as datasource:
Code: Select all
using (NorthwindDataContext context = new NorthwindDataContext())
{
var categories =
from c in context.Categories.AsEnumerable()
select c;
StiReport report = new StiReport();
report.RegData("Categories", categories);
...
}
- Attachments
-
- 1470.Linq.zip
- (14.52 KiB) Downloaded 283 times
-
- 1469.LinqToSql.Web.zip
- (191.61 KiB) Downloaded 296 times