Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exporting BDC to Excel - help me implement this example code

Status
Not open for further replies.

PushCode

Programmer
Dec 17, 2003
573
US
I have a working BDC definition that gets data from an Oracle DB. I now need to provide a way for users to export the output to Excel. I found an example online which seems to solve this problem, but I don't know how to implement this solution. Can someone help me figure this out? I'll provide my definition file, and the website that has the example code. I just need someone to tell me what goes where so I can get this working. For example I don't know where the c# code is supposed to go..in the definition file, somewhere else, etc.

Thanks!

Here's the site with the solution:
My code is below.
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>

<LobSystem
  Type="Database"
  Version="1.0.0.01"
  Name="Test_Invoice_Selector_passthrough"
  xmlns="[URL unfurl="true"]http://schemas.microsoft.com/office/2006/03/BusinessDataCatalog">[/URL]

  <Properties>
    <Property Name="WildcardCharacter" Type="System.String">%</Property>
  </Properties>

  <LobSystemInstances>
    <LobSystemInstance Name="QtoOracle_passthrough">
      <Properties>
        <Property Name="AuthenticationMode" Type="Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db.DbAuthenticationMode">PassThrough</Property>
        <Property Name="DatabaseAccessProvider" Type="Microsoft.Office.Server.ApplicationRegistry.SystemSpecific.Db.DbAccessProvider">Oracle</Property>
        <Property Name="RdbConnection Data Source" Type="System.String">myDatasource</Property>
        <Property Name="RdbConnection User Id" Type="System.String">myUserID</Property>
        <Property Name="RdbConnection Password" Type="System.String">myPassword</Property>
        <Property Name="RdbConnection Integrated Security" Type="System.String">no</Property>
        <Property Name="RdbConnection Pooling" Type="System.String">false</Property>
        <Property Name="WildcardCharacter" Type="System.String">%</Property>
      </Properties>
    </LobSystemInstance>
  </LobSystemInstances>
  <Entities>
    <Entity Name="Vendor">
      <!-- EstimatedInstanceCount is an optional attribute-->
      <Properties>
        <Property Name="company_name" Type="System.String">company_name</Property>
      </Properties>
      <Identifiers>
        <Identifier Name="invoice_id" TypeName="System.String" />
      </Identifiers>
      <Methods>
        <!-- Defines a method that brings back Vendor data from the back-end database.-->
        <Method Name="GetVendors">
          <Properties>
            <Property Name="RdbCommandText" Type="System.String">
              SELECT invoice_id, invoice_num, company_name, invoice_amount, invoice_date FROM XDIRECT_TEST WHERE (company_name LIKE :company_name) AND (invoice_num LIKE :invoice_num)
            </Property>
            <Property Name="RdbCommandType" Type="System.Data.CommandType">Text</Property>
            <!-- For database systems, can be Text, StoredProcedure, or TableDirect. -->
          </Properties>
          <FilterDescriptors>
            <!-- Define the filters supported by the back-end method (or sql query) here. -->
            <FilterDescriptor Type="Wildcard" Name="company_name" >
              <Properties>
                <Property Name="UsedForDisambiguation" Type="System.Boolean">true</Property>
              </Properties>
            </FilterDescriptor>
            <FilterDescriptor Type="Wildcard" Name="invoice_num" >
              <Properties>
                <Property Name="UsedForDisambiguation" Type="System.Boolean">true</Property>
              </Properties>
            </FilterDescriptor>
          </FilterDescriptors>
          <Parameters>
            <Parameter Direction="In" Name=":company_name">
              <TypeDescriptor TypeName="System.String" IdentifierName="invoice_id" AssociatedFilter="company_name" Name="company_name">
                <DefaultValues>
                  <DefaultValue MethodInstanceName="VendorFinderInstance" Type="System.String">%</DefaultValue>
                  <DefaultValue MethodInstanceName="VendorSpecificFinderInstance" Type="System.String">%</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="In" Name=":invoice_num">
              <TypeDescriptor TypeName="System.String" IdentifierName="invoice_id" AssociatedFilter="invoice_num" Name="invoice_num">
                <DefaultValues>
                  <DefaultValue MethodInstanceName="VendorFinderInstance" Type="System.String">%</DefaultValue>
                  <DefaultValue MethodInstanceName="VendorSpecificFinderInstance" Type="System.String">%</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="Return" Name="Vendors">
              <TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="VendorDataReader">
                <TypeDescriptors>
                  <TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="VendorDataRecord">
                    <TypeDescriptors>
                      <TypeDescriptor TypeName="System.String" IdentifierName="invoice_id" Name="invoice_num">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">Invoice Number</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.String" Name="company_name" >
                        <!-- Do not use the AssociatedFilter  attribute in return parameters.-->
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">Company Name</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property Name="DisplayByDefault" Type="System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.String" Name="invoice_amount">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">Invoice Amount Code</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property Name="DisplayByDefault" Type="System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.String" Name="invoice_date">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">Invoice Date</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
          <MethodInstances>
            <MethodInstance Name="VendorFinderInstance" Type="Finder" ReturnParameterName="Vendors" />
            <MethodInstance Name="VendorSpecificFinderInstance" Type="SpecificFinder" ReturnParameterName="Vendors" />
          </MethodInstances>
        </Method>
      </Methods>
      <!-- Enter your Action XML here -->
    </Entity>
  </Entities>
</LobSystem>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top