Showing posts with label version. Show all posts
Showing posts with label version. Show all posts

Tuesday, March 27, 2012

Bind object to RDLC Report

Hi,all
I hava a question about Bind object to RDLC Report,the RDLC like
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<DataSources>
<DataSource Name="DummyDataSource">
<ConnectionProperties>
<ConnectString />
<DataProvider>SQL</DataProvider>
</ConnectionProperties>
<rd:DataSourceID>47739726-cc8c-4719-b061-c392c2cceb68</rd:DataSourceID>
</DataSource>
</DataSources>
<BottomMargin>2.5cm</BottomMargin>
<RightMargin>2.5cm</RightMargin>
<PageWidth>21cm</PageWidth>
<rd:DrawGrid>true</rd:DrawGrid>
<InteractiveWidth>21cm</InteractiveWidth>
<rd:GridSpacing>0.25cm</rd:GridSpacing>
<rd:SnapToGrid>true</rd:SnapToGrid>
<Body>
<ColumnSpacing>1cm</ColumnSpacing>
<ReportItems>
<Table Name="table1">
<Footer>
<TableRows>
<TableRow>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox7">
<rd:DefaultName>textbox7</rd:DefaultName>
<ZIndex>7</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox8">
<rd:DefaultName>textbox8</rd:DefaultName>
<ZIndex>6</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox6">
<rd:DefaultName>textbox6</rd:DefaultName>
<ZIndex>5</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox9">
<rd:DefaultName>textbox9</rd:DefaultName>
<ZIndex>4</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
<Height>0.63492cm</Height>
</TableRow>
</TableRows>
</Footer>
<DataSetName>WindowsApplication1_MedcialCase</DataSetName>
<Top>0.25cm</Top>
<Details>
<TableRows>
<TableRow>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="ID">
<rd:DefaultName>ID</rd:DefaultName>
<ZIndex>3</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!ID.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="Name">
<rd:DefaultName>Name</rd:DefaultName>
<ZIndex>2</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!PatientOfMedcialCase.Value.Name.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="Name_1">
<rd:DefaultName>Name_1</rd:DefaultName>
<ZIndex>1</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!Name.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="PatientOfMedcialCase">
<rd:DefaultName>PatientOfMedcialCase</rd:DefaultName>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!PatientOfMedcialCase.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
<Height>0.63492cm</Height>
</TableRow>
</TableRows>
</Details>
<Header>
<TableRows>
<TableRow>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox1">
<rd:DefaultName>textbox1</rd:DefaultName>
<ZIndex>11</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>ID</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox2">
<rd:DefaultName>textbox2</rd:DefaultName>
<ZIndex>10</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>Name</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox4">
<rd:DefaultName>textbox4</rd:DefaultName>
<ZIndex>9</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>Name</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox3">
<rd:DefaultName>textbox3</rd:DefaultName>
<ZIndex>8</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>Patient Of Medcial Case</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
<Height>0.63492cm</Height>
</TableRow>
</TableRows>
</Header>
<TableColumns>
<TableColumn>
<Width>5.33333cm</Width>
</TableColumn>
<TableColumn>
<Width>8cm</Width>
</TableColumn>
<TableColumn>
<Width>5.33333cm</Width>
</TableColumn>
<TableColumn>
<Width>5.33333cm</Width>
</TableColumn>
</TableColumns>
<Height>1.90476cm</Height>
</Table>
</ReportItems>
<Height>5cm</Height>
</Body>
<rd:ReportID>a69b2d8e-258a-4212-8d4a-c67c96055732</rd:ReportID>
<LeftMargin>2.5cm</LeftMargin>
<DataSets>
<DataSet Name="WindowsApplication1_MedcialCase">
<rd:DataSetInfo>
<rd:DataSetName>WindowsApplication1</rd:DataSetName>
<rd:ObjectDataSourceType>WindowsApplication1.MedcialCase, WindowsApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
<rd:TableName>MedcialCase</rd:TableName>
</rd:DataSetInfo>
<Query>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
<CommandText />
<DataSourceName>DummyDataSource</DataSourceName>
</Query>
<Fields>
<Field Name="ID">
<rd:TypeName>System.Guid</rd:TypeName>
<DataField>ID</DataField>
</Field>
<Field Name="PatientOfMedcialCase">
<rd:TypeName>WindowsApplication1.Patient</rd:TypeName>
<DataField>PatientOfMedcialCase</DataField>
</Field>
<Field Name="Name">
<rd:TypeName>System.String</rd:TypeName>
<DataField>Name</DataField>
</Field>
</Fields>
</DataSet>
</DataSets>
<Width>24cm</Width>
<InteractiveHeight>29.7cm</InteractiveHeight>
<Language>en-US</Language>
<TopMargin>2.5cm</TopMargin>
<PageHeight>29.7cm</PageHeight>
</Report>

the object I bind to the Report like

public class MedcialCase
{
private Guid iD;

public Guid ID
{
get { return iD; }
set { iD = value; }
}

private Patient patient;

public Patient PatientOfMedcialCase
{
get { return patient; }
set { patient = value; }
}

}

public class Patient
{
private string name;

public string Name
{
get { return name; }
set { name = value; }
}

}

and the code bind object to report like

MedcialCase medcialCase = new MedcialCase();
medcialCase.ID = Guid.NewGuid();
Patient patient = new Patient();
patient.Name = "Michael";
medcialCase.PatientOfMedcialCase = patient;
this.MedcialCaseBindingSource.DataSource = medcialCase;
this.reportViewer1.RefreshReport();

I choose the MedcialCase.ID and MedcialCase.PatientOfMedcialCase.Name to show, but when the report was run ,,just MedcialCase.ID has been shown,
the text of MedcialCase.PatientOfMedcialCase.Name is "=Fields!Name.Value"

I modify it to "=Fields!PatientOfMedcialCase.Value.Name.Value" and run it ,the "#Error" show in the text of Name

anyone can tell me why?and how to bind object like MedcialCase to the Report?

thanks!

This is snippet from

http://www.gotreportviewer.com/objectdatasources/index.html

Nested objects

Only the first level of public properties can be dragged and dropped to a report. If the type of a property is a custom class with its own properties then you can manually enter an expression to access the values of second level properties. For example if the Employee class has a HomeAddress property of type Address then you can enter the expression =Fields!HomeAddress.Value.Zip to access the value of Zip property.

If the value of a property is a collection then you can use a subreport to display the collection. See this example.

In your case, this translates to "=Fields!PatientOfMedcialCase.Value.Patient.Name"

Hope that helps,

Tudor Trufinescu

|||

hi,Tudor

Thanks for your advice,

when I try to do follow your advice,I Modify the class like:

public class Book
{
private string m_title;
private string m_publisher;
private float m_listPrice;

public Book(string title, string publisher, float listPrice)
{
m_title = title;
m_publisher = publisher;
m_listPrice = listPrice;
}

public string Title
{
get { return m_title; }
set { m_title = value; }
}

public string Publisher
{
get { return m_publisher; }
set { m_publisher = value; }
}

public float ListPrice
{
get { return m_listPrice; }
set { m_listPrice = value; }
}
}

class Author
{
private int m_id;
private string m_name;
private Book book;

public Author(int id)
{
m_id = id;
}

public Author(string name, int id, Book books)
{
m_name = name;
m_id = id;
book = books;
}

public int Id
{
get { return m_id; }
set { m_id = value; }
}

public string Name
{
get { return m_name; }
set { m_name = value; }
}

public Book Books
{
get { return this.book; }
set { this.book = value; }
}
}

and report text like "=Fields!Books.Value.ListPrice" as you say,

when the report run ,the text still display the "#error"

How shall I do?

|||

I have changed the object data source sample to illustrate the use of nested objects

See this post for more details.

http://blogs.msdn.com/tudortr/archive/2006/04/10/NestedObjectsDataSource.aspx

Thanks,

Tudor

|||that's helpful,i have solved the problem,thanks!|||Just wondering why I get the following error when I use GenericsCollection:

"The Value expression for the textbox ‘AddressLine1’ refers to the field ‘Contacts’. Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope. "

for example I have these attributes of a class Company:

public Address PrivateAddress
{
get { return _privateAddress; }
set
{
_privateAddress = value;
}
}

public GenericCollection<Address> Contacts
{
get { return _contacts; }
set
{
_contacts = value;
}
}

I have no problems using the PrivateAddress object, but the Contacts gives me the above error message.

Has anyone implemented Generics objects? Any help would be appreciated.
Thanks

Bind object to RDLC Report

Hi,all
I hava a question about Bind object to RDLC Report,the RDLC like
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<DataSources>
<DataSource Name="DummyDataSource">
<ConnectionProperties>
<ConnectString />
<DataProvider>SQL</DataProvider>
</ConnectionProperties>
<rd:DataSourceID>47739726-cc8c-4719-b061-c392c2cceb68</rd:DataSourceID>
</DataSource>
</DataSources>
<BottomMargin>2.5cm</BottomMargin>
<RightMargin>2.5cm</RightMargin>
<PageWidth>21cm</PageWidth>
<rd:DrawGrid>true</rd:DrawGrid>
<InteractiveWidth>21cm</InteractiveWidth>
<rd:GridSpacing>0.25cm</rd:GridSpacing>
<rd:SnapToGrid>true</rd:SnapToGrid>
<Body>
<ColumnSpacing>1cm</ColumnSpacing>
<ReportItems>
<Table Name="table1">
<Footer>
<TableRows>
<TableRow>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox7">
<rd:DefaultName>textbox7</rd:DefaultName>
<ZIndex>7</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox8">
<rd:DefaultName>textbox8</rd:DefaultName>
<ZIndex>6</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox6">
<rd:DefaultName>textbox6</rd:DefaultName>
<ZIndex>5</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox9">
<rd:DefaultName>textbox9</rd:DefaultName>
<ZIndex>4</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
<Height>0.63492cm</Height>
</TableRow>
</TableRows>
</Footer>
<DataSetName>WindowsApplication1_MedcialCase</DataSetName>
<Top>0.25cm</Top>
<Details>
<TableRows>
<TableRow>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="ID">
<rd:DefaultName>ID</rd:DefaultName>
<ZIndex>3</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!ID.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="Name">
<rd:DefaultName>Name</rd:DefaultName>
<ZIndex>2</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!PatientOfMedcialCase.Value.Name.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="Name_1">
<rd:DefaultName>Name_1</rd:DefaultName>
<ZIndex>1</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!Name.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="PatientOfMedcialCase">
<rd:DefaultName>PatientOfMedcialCase</rd:DefaultName>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!PatientOfMedcialCase.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
<Height>0.63492cm</Height>
</TableRow>
</TableRows>
</Details>
<Header>
<TableRows>
<TableRow>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox1">
<rd:DefaultName>textbox1</rd:DefaultName>
<ZIndex>11</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>ID</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox2">
<rd:DefaultName>textbox2</rd:DefaultName>
<ZIndex>10</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>Name</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox4">
<rd:DefaultName>textbox4</rd:DefaultName>
<ZIndex>9</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>Name</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox3">
<rd:DefaultName>textbox3</rd:DefaultName>
<ZIndex>8</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>Patient Of Medcial Case</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
<Height>0.63492cm</Height>
</TableRow>
</TableRows>
</Header>
<TableColumns>
<TableColumn>
<Width>5.33333cm</Width>
</TableColumn>
<TableColumn>
<Width>8cm</Width>
</TableColumn>
<TableColumn>
<Width>5.33333cm</Width>
</TableColumn>
<TableColumn>
<Width>5.33333cm</Width>
</TableColumn>
</TableColumns>
<Height>1.90476cm</Height>
</Table>
</ReportItems>
<Height>5cm</Height>
</Body>
<rd:ReportID>a69b2d8e-258a-4212-8d4a-c67c96055732</rd:ReportID>
<LeftMargin>2.5cm</LeftMargin>
<DataSets>
<DataSet Name="WindowsApplication1_MedcialCase">
<rd:DataSetInfo>
<rd:DataSetName>WindowsApplication1</rd:DataSetName>
<rd:ObjectDataSourceType>WindowsApplication1.MedcialCase, WindowsApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
<rd:TableName>MedcialCase</rd:TableName>
</rd:DataSetInfo>
<Query>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
<CommandText />
<DataSourceName>DummyDataSource</DataSourceName>
</Query>
<Fields>
<Field Name="ID">
<rd:TypeName>System.Guid</rd:TypeName>
<DataField>ID</DataField>
</Field>
<Field Name="PatientOfMedcialCase">
<rd:TypeName>WindowsApplication1.Patient</rd:TypeName>
<DataField>PatientOfMedcialCase</DataField>
</Field>
<Field Name="Name">
<rd:TypeName>System.String</rd:TypeName>
<DataField>Name</DataField>
</Field>
</Fields>
</DataSet>
</DataSets>
<Width>24cm</Width>
<InteractiveHeight>29.7cm</InteractiveHeight>
<Language>en-US</Language>
<TopMargin>2.5cm</TopMargin>
<PageHeight>29.7cm</PageHeight>
</Report>

the object I bind to the Report like

public class MedcialCase
{
private Guid iD;

public Guid ID
{
get { return iD; }
set { iD = value; }
}

private Patient patient;

public Patient PatientOfMedcialCase
{
get { return patient; }
set { patient = value; }
}

}

public class Patient
{
private string name;

public string Name
{
get { return name; }
set { name = value; }
}

}

and the code bind object to report like

MedcialCase medcialCase = new MedcialCase();
medcialCase.ID = Guid.NewGuid();
Patient patient = new Patient();
patient.Name = "Michael";
medcialCase.PatientOfMedcialCase = patient;
this.MedcialCaseBindingSource.DataSource = medcialCase;
this.reportViewer1.RefreshReport();

I choose the MedcialCase.ID and MedcialCase.PatientOfMedcialCase.Name to show, but when the report was run ,,just MedcialCase.ID has been shown,
the text of MedcialCase.PatientOfMedcialCase.Name is "=Fields!Name.Value"

I modify it to "=Fields!PatientOfMedcialCase.Value.Name.Value" and run it ,the "#Error" show in the text of Name

anyone can tell me why?and how to bind object like MedcialCase to the Report?

thanks!

This is snippet from

http://www.gotreportviewer.com/objectdatasources/index.html

Nested objects

Only the first level of public properties can be dragged and dropped to a report. If the type of a property is a custom class with its own properties then you can manually enter an expression to access the values of second level properties. For example if the Employee class has a HomeAddress property of type Address then you can enter the expression =Fields!HomeAddress.Value.Zip to access the value of Zip property.

If the value of a property is a collection then you can use a subreport to display the collection. See this example.

In your case, this translates to "=Fields!PatientOfMedcialCase.Value.Patient.Name"

Hope that helps,

Tudor Trufinescu

|||

hi,Tudor

Thanks for your advice,

when I try to do follow your advice,I Modify the class like:

public class Book
{
private string m_title;
private string m_publisher;
private float m_listPrice;

public Book(string title, string publisher, float listPrice)
{
m_title = title;
m_publisher = publisher;
m_listPrice = listPrice;
}

public string Title
{
get { return m_title; }
set { m_title = value; }
}

public string Publisher
{
get { return m_publisher; }
set { m_publisher = value; }
}

public float ListPrice
{
get { return m_listPrice; }
set { m_listPrice = value; }
}
}

class Author
{
private int m_id;
private string m_name;
private Book book;

public Author(int id)
{
m_id = id;
}

public Author(string name, int id, Book books)
{
m_name = name;
m_id = id;
book = books;
}

public int Id
{
get { return m_id; }
set { m_id = value; }
}

public string Name
{
get { return m_name; }
set { m_name = value; }
}

public Book Books
{
get { return this.book; }
set { this.book = value; }
}
}

and report text like "=Fields!Books.Value.ListPrice" as you say,

when the report run ,the text still display the "#error"

How shall I do?

|||

I have changed the object data source sample to illustrate the use of nested objects

See this post for more details.

http://blogs.msdn.com/tudortr/archive/2006/04/10/NestedObjectsDataSource.aspx

Thanks,

Tudor

|||that's helpful,i have solved the problem,thanks!|||Just wondering why I get the following error when I use GenericsCollection:

"The Value expression for the textbox ‘AddressLine1’ refers to the field ‘Contacts’. Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope. "

for example I have these attributes of a class Company:

public Address PrivateAddress
{
get { return _privateAddress; }
set
{
_privateAddress = value;
}
}

public GenericCollection<Address> Contacts
{
get { return _contacts; }
set
{
_contacts = value;
}
}

I have no problems using the PrivateAddress object, but the Contacts gives me the above error message.

Has anyone implemented Generics objects? Any help would be appreciated.
Thanks
sql

Monday, March 19, 2012

BIDS problem

I just installed the RTM of the standard version of SQL Server 2005 Client Tools on a Windows XP machine.

When I initially opened the SQL Server Business Intelligence Development Studio, I received about 6 pop-up messages saying that it couldn't load a package (I didn't copy the message and can't get it to repeat now).

When I try to create an Analysis Services package, I now get the message:
"Could not load type 'Microsoft.VisualStudio.Shell.Interop.IVsHasRelatedSaveItems' from assembly 'Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

I believe this is some sort of setup issue, but am not sure how to troubleshoot or fix this.

Thanks for your help,
Jessica

I'm getting the exact same error when I try to create a new report. Any luck in figuring it out?

|||FYI - I found the solution in case you are still looking. Go here http://forums.microsoft.com/msdn/showpost.aspx?postid=2098&siteid=1|||Thanks Mike! That did the trick :-D

BIDS problem

I just installed the RTM of the standard version of SQL Server 2005 Client Tools on a Windows XP machine.

When I initially opened the SQL Server Business Intelligence Development Studio, I received about 6 pop-up messages saying that it couldn't load a package (I didn't copy the message and can't get it to repeat now).

When I try to create an Analysis Services package, I now get the message:
"Could not load type 'Microsoft.VisualStudio.Shell.Interop.IVsHasRelatedSaveItems' from assembly 'Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

I believe this is some sort of setup issue, but am not sure how to troubleshoot or fix this.

Thanks for your help,
Jessica

I'm getting the exact same error when I try to create a new report. Any luck in figuring it out?

|||FYI - I found the solution in case you are still looking. Go here http://forums.microsoft.com/msdn/showpost.aspx?postid=2098&siteid=1|||Thanks Mike! That did the trick :-D

Sunday, March 11, 2012

Bidirectional Replication

Hi,

can you pls help me to find the suitable Version of SQL Server?

SQL Server will work on the serverside. MS Access on the clientside.

Between these two DBs i need asynchronous bidirectional replication.

What version of SQL Server would be the best solution for this?

Thanx for ur help

Greetz CreanCan you upgrade the databse engine on the MS-Access side to MSDE instead of Jet? If not, I think you've got a real challenge.

-PatP|||Yes i can upgrade to msde.

So what version of sql server should i take?

Thx

Crean|||Use Windows Explorer to check to see if MSDE is provided on your MS-Access CD. If so, use that version of MSDE, otherwise grab the first version that you find (the average user almost always finds the most stable supported version first if they aren't looking for a specific version).

-PatP|||Ok, thx Pat

Greetz Crean

Thursday, March 8, 2012

BI Accelerator Version Error

I am evaluating the BI Accelerator samples Excel 2003 SP1, however I receive
this warning "The Analytics Builder Workbook requires Excel XP, SP1 or
greater" and then the Excel file closes.
Is there a work around for this please?Please look at this page.
http://www.webservertalk.com/archiv...p/t-954076.html
I had the same problem.
http://blogs.sqlpassj.org/nagasaki/...03/22/8178.aspx
(--Japanese)
Tomoyoshi NAGASAKI
Message posted via http://www.droptable.com

BI Accelerator Version Error

I am evaluating the BI Accelerator samples Excel 2003 SP1, however I receive
this warning "The Analytics Builder Workbook requires Excel XP, SP1 or
greater" and then the Excel file closes.
Is there a work around for this please?
Please look at this page.
http://www.webservertalk.com/archive.../t-954076.html
I had the same problem.
http://blogs.sqlpassj.org/nagasaki/a...3/22/8178.aspx
(--Japanese)
Tomoyoshi NAGASAKI
Message posted via http://www.sqlmonster.com

Friday, February 24, 2012

Beta Data Conversion

I have a data file in Beta 2 version, but now I've already uninstalled the
beta version and installed a new Release Version of SQLServer 2005. Does
anybody know how to convert the data file to be usable in SQLServer 2005?Jeffry
Are you talking about .MDF datafile? If you are , have you tried to attach
the file? There are two system stored procedures as sp_detach_db,
sp_attach_db
"Jeffrey Kam" <Jeffrey Kam@.discussions.microsoft.com> wrote in message
news:913ABCEF-F02C-44A2-B9C0-881A7452D331@.microsoft.com...
>I have a data file in Beta 2 version, but now I've already uninstalled the
> beta version and installed a new Release Version of SQLServer 2005. Does
> anybody know how to convert the data file to be usable in SQLServer 2005?|||i tried to attach directly but it said it doesn't support beta version
"Uri Dimant" wrote:
> Jeffry
> Are you talking about .MDF datafile? If you are , have you tried to attach
> the file? There are two system stored procedures as sp_detach_db,
> sp_attach_db
>
>
>
> "Jeffrey Kam" <Jeffrey Kam@.discussions.microsoft.com> wrote in message
> news:913ABCEF-F02C-44A2-B9C0-881A7452D331@.microsoft.com...
> >I have a data file in Beta 2 version, but now I've already uninstalled the
> > beta version and installed a new Release Version of SQLServer 2005. Does
> > anybody know how to convert the data file to be usable in SQLServer 2005?
>
>|||Yep, I see. Probably RESTORE command will not work as well.
Do you have still BETA CD to install it and transfer the data ?
Unfortanutally I have no idea (if above does not work) how to restore the
data
"Jeffrey Kam" <JeffreyKam@.discussions.microsoft.com> wrote in message
news:EE6DD8D9-FE2E-4566-903F-05F3748C2E7A@.microsoft.com...
>i tried to attach directly but it said it doesn't support beta version
> "Uri Dimant" wrote:
>> Jeffry
>> Are you talking about .MDF datafile? If you are , have you tried to
>> attach
>> the file? There are two system stored procedures as sp_detach_db,
>> sp_attach_db
>>
>>
>>
>> "Jeffrey Kam" <Jeffrey Kam@.discussions.microsoft.com> wrote in message
>> news:913ABCEF-F02C-44A2-B9C0-881A7452D331@.microsoft.com...
>> >I have a data file in Beta 2 version, but now I've already uninstalled
>> >the
>> > beta version and installed a new Release Version of SQLServer 2005.
>> > Does
>> > anybody know how to convert the data file to be usable in SQLServer
>> > 2005?
>>|||Thank you for your reply
Sorry, I still couldn't find it. that's why I want a solution without setup
another Beta 2. Does Microsoft provide such tools?
"Uri Dimant" wrote:
> Yep, I see. Probably RESTORE command will not work as well.
> Do you have still BETA CD to install it and transfer the data ?
>
> Unfortanutally I have no idea (if above does not work) how to restore the
> data
>
> "Jeffrey Kam" <JeffreyKam@.discussions.microsoft.com> wrote in message
> news:EE6DD8D9-FE2E-4566-903F-05F3748C2E7A@.microsoft.com...
> >i tried to attach directly but it said it doesn't support beta version
> >
> > "Uri Dimant" wrote:
> >
> >> Jeffry
> >> Are you talking about .MDF datafile? If you are , have you tried to
> >> attach
> >> the file? There are two system stored procedures as sp_detach_db,
> >> sp_attach_db
> >>
> >>
> >>
> >>
> >>
> >>
> >> "Jeffrey Kam" <Jeffrey Kam@.discussions.microsoft.com> wrote in message
> >> news:913ABCEF-F02C-44A2-B9C0-881A7452D331@.microsoft.com...
> >> >I have a data file in Beta 2 version, but now I've already uninstalled
> >> >the
> >> > beta version and installed a new Release Version of SQLServer 2005.
> >> > Does
> >> > anybody know how to convert the data file to be usable in SQLServer
> >> > 2005?
> >>
> >>
> >>
>
>|||Hi
I am not aware of such tools , sorry
"Jeffrey Kam" <JeffreyKam@.discussions.microsoft.com> wrote in message
news:BF911B6B-A4F6-4740-8DBA-46C09EB9BF20@.microsoft.com...
> Thank you for your reply
> Sorry, I still couldn't find it. that's why I want a solution without
> setup
> another Beta 2. Does Microsoft provide such tools?
> "Uri Dimant" wrote:
>> Yep, I see. Probably RESTORE command will not work as well.
>> Do you have still BETA CD to install it and transfer the data ?
>>
>> Unfortanutally I have no idea (if above does not work) how to restore the
>> data
>>
>> "Jeffrey Kam" <JeffreyKam@.discussions.microsoft.com> wrote in message
>> news:EE6DD8D9-FE2E-4566-903F-05F3748C2E7A@.microsoft.com...
>> >i tried to attach directly but it said it doesn't support beta version
>> >
>> > "Uri Dimant" wrote:
>> >
>> >> Jeffry
>> >> Are you talking about .MDF datafile? If you are , have you tried to
>> >> attach
>> >> the file? There are two system stored procedures as sp_detach_db,
>> >> sp_attach_db
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> "Jeffrey Kam" <Jeffrey Kam@.discussions.microsoft.com> wrote in message
>> >> news:913ABCEF-F02C-44A2-B9C0-881A7452D331@.microsoft.com...
>> >> >I have a data file in Beta 2 version, but now I've already
>> >> >uninstalled
>> >> >the
>> >> > beta version and installed a new Release Version of SQLServer 2005.
>> >> > Does
>> >> > anybody know how to convert the data file to be usable in SQLServer
>> >> > 2005?
>> >>
>> >>
>> >>
>>

Beta Data Conversion

I have a data file in Beta 2 version, but now I've already uninstalled the
beta version and installed a new Release Version of SQLServer 2005. Does
anybody know how to convert the data file to be usable in SQLServer 2005?
Jeffry
Are you talking about .MDF datafile? If you are , have you tried to attach
the file? There are two system stored procedures as sp_detach_db,
sp_attach_db
"Jeffrey Kam" <Jeffrey Kam@.discussions.microsoft.com> wrote in message
news:913ABCEF-F02C-44A2-B9C0-881A7452D331@.microsoft.com...
>I have a data file in Beta 2 version, but now I've already uninstalled the
> beta version and installed a new Release Version of SQLServer 2005. Does
> anybody know how to convert the data file to be usable in SQLServer 2005?
|||i tried to attach directly but it said it doesn't support beta version
"Uri Dimant" wrote:

> Jeffry
> Are you talking about .MDF datafile? If you are , have you tried to attach
> the file? There are two system stored procedures as sp_detach_db,
> sp_attach_db
>
>
>
> "Jeffrey Kam" <Jeffrey Kam@.discussions.microsoft.com> wrote in message
> news:913ABCEF-F02C-44A2-B9C0-881A7452D331@.microsoft.com...
>
>
|||Yep, I see. Probably RESTORE command will not work as well.
Do you have still BETA CD to install it and transfer the data ?
Unfortanutally I have no idea (if above does not work) how to restore the
data
"Jeffrey Kam" <JeffreyKam@.discussions.microsoft.com> wrote in message
news:EE6DD8D9-FE2E-4566-903F-05F3748C2E7A@.microsoft.com...[vbcol=seagreen]
>i tried to attach directly but it said it doesn't support beta version
> "Uri Dimant" wrote:
|||Thank you for your reply
Sorry, I still couldn't find it. that's why I want a solution without setup
another Beta 2. Does Microsoft provide such tools?
"Uri Dimant" wrote:

> Yep, I see. Probably RESTORE command will not work as well.
> Do you have still BETA CD to install it and transfer the data ?
>
> Unfortanutally I have no idea (if above does not work) how to restore the
> data
>
> "Jeffrey Kam" <JeffreyKam@.discussions.microsoft.com> wrote in message
> news:EE6DD8D9-FE2E-4566-903F-05F3748C2E7A@.microsoft.com...
>
>
|||Hi
I am not aware of such tools , sorry
"Jeffrey Kam" <JeffreyKam@.discussions.microsoft.com> wrote in message
news:BF911B6B-A4F6-4740-8DBA-46C09EB9BF20@.microsoft.com...[vbcol=seagreen]
> Thank you for your reply
> Sorry, I still couldn't find it. that's why I want a solution without
> setup
> another Beta 2. Does Microsoft provide such tools?
> "Uri Dimant" wrote:

Beta Data Conversion

I have a data file in Beta 2 version, but now I've already uninstalled the
beta version and installed a new Release Version of SQLServer 2005. Does
anybody know how to convert the data file to be usable in SQLServer 2005?Jeffry
Are you talking about .MDF datafile? If you are , have you tried to attach
the file? There are two system stored procedures as sp_detach_db,
sp_attach_db
"Jeffrey Kam" <Jeffrey Kam@.discussions.microsoft.com> wrote in message
news:913ABCEF-F02C-44A2-B9C0-881A7452D331@.microsoft.com...
>I have a data file in Beta 2 version, but now I've already uninstalled the
> beta version and installed a new Release Version of SQLServer 2005. Does
> anybody know how to convert the data file to be usable in SQLServer 2005?|||i tried to attach directly but it said it doesn't support beta version
"Uri Dimant" wrote:

> Jeffry
> Are you talking about .MDF datafile? If you are , have you tried to attac
h
> the file? There are two system stored procedures as sp_detach_db,
> sp_attach_db
>
>
>
> "Jeffrey Kam" <Jeffrey Kam@.discussions.microsoft.com> wrote in message
> news:913ABCEF-F02C-44A2-B9C0-881A7452D331@.microsoft.com...
>
>|||Yep, I see. Probably RESTORE command will not work as well.
Do you have still BETA CD to install it and transfer the data ?
Unfortanutally I have no idea (if above does not work) how to restore the
data
"Jeffrey Kam" <JeffreyKam@.discussions.microsoft.com> wrote in message
news:EE6DD8D9-FE2E-4566-903F-05F3748C2E7A@.microsoft.com...[vbcol=seagreen]
>i tried to attach directly but it said it doesn't support beta version
> "Uri Dimant" wrote:
>|||Thank you for your reply
Sorry, I still couldn't find it. that's why I want a solution without setup
another Beta 2. Does Microsoft provide such tools?
"Uri Dimant" wrote:

> Yep, I see. Probably RESTORE command will not work as well.
> Do you have still BETA CD to install it and transfer the data ?
>
> Unfortanutally I have no idea (if above does not work) how to restore the
> data
>
> "Jeffrey Kam" <JeffreyKam@.discussions.microsoft.com> wrote in message
> news:EE6DD8D9-FE2E-4566-903F-05F3748C2E7A@.microsoft.com...
>
>|||Hi
I am not aware of such tools , sorry
"Jeffrey Kam" <JeffreyKam@.discussions.microsoft.com> wrote in message
news:BF911B6B-A4F6-4740-8DBA-46C09EB9BF20@.microsoft.com...[vbcol=seagreen]
> Thank you for your reply
> Sorry, I still couldn't find it. that's why I want a solution without
> setup
> another Beta 2. Does Microsoft provide such tools?
> "Uri Dimant" wrote:
>

Thursday, February 16, 2012

Best way to mirror data?

I've got two SQL servers (sql server 2000 version 8.0) (dev) and (live).
I'm constantly exporting/importing across from one to the other using the
export/import tool within SQL Enterprise Manager. I'm consistently having
to update "default values" etc. as they are wiped clean when I
import/export.
I could do a script dump in SQL Query Analyzer for each table, but I was
figuring there had to be a better way to do this...?How about a job to do a backup on one, copy it across the network, then
restore on server 2? You also have the copy database wizard in DTS although
I've never used it
Ray Higdon MCSE, MCDBA, CCNA
--
"Jesse Bilsten" <jesse@.vreo.com> wrote in message
news:OaExfP%23$DHA.688@.tk2msftngp13.phx.gbl...
> I've got two SQL servers (sql server 2000 version 8.0) (dev) and (live).
> I'm constantly exporting/importing across from one to the other using the
> export/import tool within SQL Enterprise Manager. I'm consistently having
> to update "default values" etc. as they are wiped clean when I
> import/export.
> I could do a script dump in SQL Query Analyzer for each table, but I was
> figuring there had to be a better way to do this...?
>
>|||You can try SQL Compare from Red-Gate. It isn't perfect, but it is better
than most 'roll your own' systems that I have seen, including my own.
www.red-gate.com
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Jesse Bilsten" <jesse@.vreo.com> wrote in message
news:OaExfP%23$DHA.688@.tk2msftngp13.phx.gbl...
> I've got two SQL servers (sql server 2000 version 8.0) (dev) and (live).
> I'm constantly exporting/importing across from one to the other using the
> export/import tool within SQL Enterprise Manager. I'm consistently having
> to update "default values" etc. as they are wiped clean when I
> import/export.
> I could do a script dump in SQL Query Analyzer for each table, but I was
> figuring there had to be a better way to do this...?
>
>|||Check out DB Ghost from Innovartis at http://www.dbghost.com
Darren Fuller
SQL Server DBA MCSE
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Best way to mirror data?

I've got two SQL servers (sql server 2000 version 8.0) (dev) and (live).
I'm constantly exporting/importing across from one to the other using the
export/import tool within SQL Enterprise Manager. I'm consistently having
to update "default values" etc. as they are wiped clean when I
import/export.
I could do a script dump in SQL Query Analyzer for each table, but I was
figuring there had to be a better way to do this...?How about a job to do a backup on one, copy it across the network, then
restore on server 2? You also have the copy database wizard in DTS although
I've never used it
--
Ray Higdon MCSE, MCDBA, CCNA
--
"Jesse Bilsten" <jesse@.vreo.com> wrote in message
news:OaExfP%23$DHA.688@.tk2msftngp13.phx.gbl...
> I've got two SQL servers (sql server 2000 version 8.0) (dev) and (live).
> I'm constantly exporting/importing across from one to the other using the
> export/import tool within SQL Enterprise Manager. I'm consistently having
> to update "default values" etc. as they are wiped clean when I
> import/export.
> I could do a script dump in SQL Query Analyzer for each table, but I was
> figuring there had to be a better way to do this...?
>
>|||You can try SQL Compare from Red-Gate. It isn't perfect, but it is better
than most 'roll your own' systems that I have seen, including my own.
www.red-gate.com
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Jesse Bilsten" <jesse@.vreo.com> wrote in message
news:OaExfP%23$DHA.688@.tk2msftngp13.phx.gbl...
> I've got two SQL servers (sql server 2000 version 8.0) (dev) and (live).
> I'm constantly exporting/importing across from one to the other using the
> export/import tool within SQL Enterprise Manager. I'm consistently having
> to update "default values" etc. as they are wiped clean when I
> import/export.
> I could do a script dump in SQL Query Analyzer for each table, but I was
> figuring there had to be a better way to do this...?
>
>|||You can easily create a job in SQL Server Agent.
>--Original Message--
>I've got two SQL servers (sql server 2000 version 8.0)
(dev) and (live).
>I'm constantly exporting/importing across from one to the
other using the
>export/import tool within SQL Enterprise Manager. I'm
consistently having
>to update "default values" etc. as they are wiped clean
when I
>import/export.
>I could do a script dump in SQL Query Analyzer for each
table, but I was
>figuring there had to be a better way to do this...?
>
>.
>

Best way to migrate SQL version 7 databases to 2000

We are moving all databases from a SQL version 7 server to a version 2000
server. Which of the following is the preferred method?

1) Detach the DB on the version 7 server, move it to the new server via
Windows Explorer and reattach it there.

2) Use SQL Enterprise Mananger with the DTS Export Wizard to "copy objects &
data between SQL server databases" from the version 7 server to the 2000
server.

With the changing of the version, I thought maybe option 2 is best. Thoughts?

--
Mike Czizek
Iowa Network Services, Inc.
mikec@.netins.comConsider using backup-restore method. It works rather well.

--
Dean Savovic
www.teched.hr

"Mike Czizek" <Mikec@.netins.net> wrote in message news:bnts03$5b8$1@.ins22.netins.net...
> We are moving all databases from a SQL version 7 server to a version 2000
> server. Which of the following is the preferred method?
> 1) Detach the DB on the version 7 server, move it to the new server via
> Windows Explorer and reattach it there.
> 2) Use SQL Enterprise Mananger with the DTS Export Wizard to "copy objects &
> data between SQL server databases" from the version 7 server to the 2000
> server.
> With the changing of the version, I thought maybe option 2 is best. Thoughts?
> --
> Mike Czizek
> Iowa Network Services, Inc.
> mikec@.netins.com