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.

  • 相关阅读:
    JSON数据的中文乱码问题
    使用json-lib进行Java和JSON之间的转换
    struts2 struts.xml配置文件详解
    php位运算的应用(转)
    oracle数据库导入导出的dmp(转)
    Java多线程-工具篇-BlockingQueue(转)
    javaweb之Filter详解(转)
    MYSQL写入数据时报错ERROR 1366 (HY000): Incorrect string value: 'xE8x8BxB1xE5xAFxB8...' for c 插入中文不能插入
    插入中文错误ERROR 1406 (22001): Data too long for column 'name' at row 1
    SQL语句处理一些修改、新增、删除、修改属性操作(MySql)
  • 原文地址:https://www.cnblogs.com/fuyingke/p/95722.html
Copyright © 2011-2022 走看看