zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    简单的排序算法总结
    Android Stuido 方法参数 p0,p1
    年与酒
    Android-自定义View前传-View的三大流程-Layout
    Android自定义View前传-View的三大流程-Measure
    寻找积极
    括号配对问题
    Wan Android 项目总结
    涂鸦之作WanAndroid第三方APP
    CSS-定位(Position)
  • 原文地址:https://www.cnblogs.com/fuyingke/p/95722.html
Copyright © 2011-2022 走看看