ITPub博客

首页 > IT基础架构 > 网络安全 > DBReader/Classes/Logon

DBReader/Classes/Logon

原创 网络安全 作者:njms 时间:2007-09-11 23:06:58 0 删除 编辑

/**
*
* DBReader 1.0, Access to SAP tables using SAP's .Net Connector.
*
* Author: hardteck
* Email: hardteck@web.de
*
* Last modified: Fr, 17. Okt 2003, 11:31:32
*/
namespace SAPReader {
using System;
///


/// The Logon encapsulates the SAPLogon.
///
///

public class Logon : SAP.Connector.SAPLogonDestination {
///
/// The Constructor.
///

public Logon(){}
///
/// Given the name of an SAP System, this method returns
/// the corresponding destination object.
///

///
/// Name of the SAP System as displayed in the list
/// of available destinations.
///
///
public SAP.Connector.Destination getDestinationByName(string name){
// Map the name used for displaying the available destination,
// e.g. at SAPLogon, to the internal name used to address this item.
// BTW, the internal name (key) is derived from saplogon.ini.
string destName = this.GetDestinationNameFromPrintName(name);
// null returned if the destination does not exist.
if(destName == null || destName == "" ){
Console.WriteLine(this.GetType().ToString()
+ ".getDestinationByName: Destination " + name + " does not exist."
);
Console.WriteLine("Available Destinations are: ");
this.printAvailableDestinations(Console.Out);
Environment.Exit(0);
}
// This is the key statement for selecting the desired destination item:
this.DestinationName = destName;
// Now all information is retrieved from the SAPLogon's ini file
// to the respective variables of 'this' destination object.
// (The ini file is stored in the private variable:
// SAP.Connector.SAPLogonDestination.saplogon.fileName)

return (SAP.Connector.Destination)this;
}
///


/// Writes a list of available destinations to a stream.
///

/// Stream to write to.
public void printAvailableDestinations(System.IO.TextWriter txtWriter){
foreach(System.Collections.DictionaryEntry dest in this.AvailableDestinations){
txtWriter.WriteLine(dest.Value.ToString());
}
}
}
}

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/232040/viewspace-968998/,如需转载,请注明出处,否则将追究法律责任。

下一篇: DBReader/Classes/Proxy
请登录后发表评论 登录
全部评论
  • 博文量
    15
  • 访问量
    53860