• Delphi2005> WebService


    unit WebService1;

    interface

    uses
      system.Data ,system.Data.SqlClient , system.configuration,
      System.Collections, System.ComponentModel,
      System.Diagnostics, System.Web,
      System.Web.Services;

    type
      /// <summary>
      /// Summary description for WebService1.
      /// </summary>
      TWebService1 = class(System.Web.Services.WebService)
      {$REGION 'Designer Managed Code'}
      strict private
        /// <summary>
        /// Required designer variable.
        /// </summary>
        components: IContainer;
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        procedure InitializeComponent;
      {$ENDREGION}
      strict protected
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        procedure Dispose(disposing: boolean); override;
      private
        { Private Declarations }
        AdoConn : system.Data.SqlClient.SqlConnection ;
        AdoDa:system.Data.SqlClient.SqlDataAdapter;
        AdoDataSet:system.Data.DataSet ;

      public
        constructor Create;

        // Sample Web Service Method
        [WebMethod]
        function HelloWorld: string;

            [WebMethod]   function GetDataSet: dataset;

      end;

    implementation

    {$REGION 'Designer Managed Code'}
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    procedure TWebService1.InitializeComponent;
    begin

    end;
    {$ENDREGION}

    constructor TWebService1.Create;
    begin
      inherited;

    //c#


    //using System.Configuration;

    //ConfigurationSettings.AppSettings["SQLConnectionString"];
              AdoConn:= system.Data.SqlClient.SqlConnection.Create(ConfigurationSettings.AppSettings['SQLConnectionString']);
               AdoDa:=system.Data.SqlClient.SqlDataAdapter.Create('select * from base01',adoconn);

                 AdoDataSet:=system.Data.DataSet.Create ;
                 adoda.Fill(AdoDataSet)  ;


      //
      // Required for Designer support
      //
      InitializeComponent;
      //
      // TODO: Add any constructor code after InitializeComponent call
      //
    end;

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    procedure TWebService1.Dispose(disposing: boolean);
    begin
      if disposing and (components <> nil) then
        components.Dispose;
      inherited Dispose(disposing);
    end;

    // Sample Web Service Method
    // The following method is provided to allow for testing a new web service.

    function TWebService1.HelloWorld: string;
    begin
      Result := 'Hello World';
    end;


    function TWebService1.GetDataSet: dataset;
    begin

       Result := AdoDataSet;

    end;

    end.

  • 相关阅读:
    倍增
    「BZOJ 2152」聪聪可可
    「POJ 1741」Tree
    点分治
    高斯消元
    网络流24题之餐巾计划问题
    网络流24题之骑士共存问题
    网络流24题之方格取数问题
    网络流24题之负载平衡问题
    网络流24题之分配问题
  • 原文地址:https://www.cnblogs.com/fuyingke/p/95722.html
Copyright © 2020-2023  润新知