Click to Rate and Give Feedback
MSDN
MSDN Library
BizTalk Server
Development
 Performing a SELECT Query on Busine...
Collapse All/Expand All Collapse All
Performing a SELECT Query on Business Components

This section demonstrates how to select data from a Siebel business component using the .NET Framework Data Provider for Siebel eBusiness Applications.

This section demonstrates how to select data from the "Account" business component in the Siebel repository.

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Common;
using Microsoft.Adapters.SiebelDbProvider;

namespace SiebelADO
{
 class Program
  {
   static void Main(string[] args)
    {
     try
      {
        SiebelProviderFactory factory = SiebelProviderFactory.Instance;
        DbConnection connection = factory.CreateConnection();
        connection.ConnectionString = "Username=SADMIN;Password=SADMIN;ServiceUri=172.23.115.223:2321;SiebelObjectManager=SSEObjMgr;SiebelEnterpriseServer=ent771;Language=enu;SiebelRepository=Siebel Repository";

         connection.Open();
         DbCommand command = connection.CreateCommand();
                
         //Here is a list of sample commands. The second command shows how the Siebel ViewMode can be specified in the query.
         //command.CommandText = "SELECT * from Account.Account where [Name] LIKE '3Com'";
         //command.CommandText = "Select [Name] from [Account].[Account] where [Name] LIKE '3Com' OPTION ‘ViewMode 1’";
           command.CommandText = "SELECT [Name], [Postal Code], Id From Account.Account where [Postal Code] != '60626' Order BY Id ASC, Name DESC";
         
         DbDataReader dbReader = command.ExecuteReader();
         
         while (dbReader.Read())
           {
              for (int i = 0; i < dbReader.FieldCount; i++)
               {
                 string name = dbReader.GetName(i);
                 string val = dbReader[i].ToString();
                 Console.WriteLine(name + "\t:" + val);
                 Console.WriteLine("=========================");
               }
           }
             Console.WriteLine("Press any key...");
             Console.ReadLine();
       }
       catch (Exception exp) { Console.WriteLine(exp.Message); }
       }
    }
}
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker