Are you missing a using directive or an assembly reference?

Stimulsoft Reports.NET discussion
Post Reply
Marinus
Posts: 10
Joined: Wed Jul 01, 2009 3:21 am
Location: Lillehammer

Are you missing a using directive or an assembly reference?

Post by Marinus »

I generate a report:

The data comes from a server. A Myservice.Bike.Model.dll is in the bin-catalogue (just like the Stimulsoft-dll's).

Myservice.Bike.Model.Ordersns.Product[] data = ServiceProvider.OrderService.RetrieveAllProducts();
StiReport report = new StiReport();
report.RegData("MyData", data);
report.Design();

The hiearchical list with Products shows fine in the Dictionary under the DataSource-node.
In the report-code "Myservice.Bike.Model" shows up in several places.
For instance:

public virtual Myservice.Bike.Model.Ordersns.ProductIdent ProductIdent
{
get
{
return ((Myservice.Bike.Model.Ordersns.ProductIdent)(StiReport.ChangeType(this["ProductIdent"], typeof(Myservice.Bike.Model.Ordersns.ProductIdent), true)));
}
}

When I try to preview the report I get an error:
c:\Users\.....\AppData\Local\Temp\xdmonrkw.0.cs(147,28) : error CS0246: :shame:
The type or namespace name 'Myservice' could not be found (are you missing a using directive or an assembly reference?)

Do I have my dll's in the wrong place. What to do?
Marinus
Posts: 10
Joined: Wed Jul 01, 2009 3:21 am
Location: Lillehammer

Are you missing a using directive or an assembly reference?

Post by Marinus »

Sorry for the question. I found the answer... :shame:

Myservice.Bike.Model.Ordersns.Product[] data = ServiceProvider.OrderService.RetrieveAllProducts();
StiReport report = new StiReport();

string[] references = report.ReferencedAssemblies;
// Converting the the array to a collection
List newReferences = references.ToList();
// Add your Assembly to the list
newReferences.Add("Myservice.Bikes.Model.dll");
// Reset the array of referenced assembly with the converted collection
report.ReferencedAssemblies = newReferences.ToArray();

report.RegData("MyData", data);
report.Design();

Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Are you missing a using directive or an assembly reference?

Post by Andrew »

Great!

Thank you.
Post Reply