• <label id="pxtpz"><meter id="pxtpz"></meter></label>
      1. <span id="pxtpz"><optgroup id="pxtpz"></optgroup></span>

        當前位置:雨林木風下載站 > 技術開發教程 > 詳細頁面

        ADO 2.6 vs. the ADO.NET

        ADO 2.6 vs. the ADO.NET

        更新時間:2022-05-16 文章作者:未知 信息來源:網絡 閱讀次數:

        ADO 2.6 vs. the ADO.NET
        在本例中我們需要IIS5環境、Visual Studio.NET BETA1、還有SQL SERVER中的Northwind數據庫
        在.NET中,保持了對早先COM及基于COM技術的良好支持,在本例中提供了兩種方法:GetCustomersOld() 使用了ADO2.6;GetCustomersNew() 使用ADO.NET,可以對比。

        namespace PROINFO.WebService.Data
        {
        using System;
        using System.Collections;
        using System.Configuration;
        using System.ComponentModel;
        using System.Data;
        using System.Data.SQL;
        using System.Diagnostics;
        using System.Web;
        using System.Web.Services;
        /// <summary>
        /// Summary description for WS.
        /// </summary>
        public class WS : System.Web.Services.WebService
        {
        public WS()
        {
        //CODEGEN: This call is required by the ASP+ Web Services Designer
        InitializeComponent();
        }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
        }
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        public override void Dispose()
        {
        }

        // Here starts the example code
        public struct sCustomers
        {
        public String sCustomerID;
        public String sCompanyName;
        public String sContactName;
        public String sContactTitle;
        public String sAddress;
        public String sCity;
        public String sRegion;
        public String sPostalCode;
        public String sCountry;
        public String sPhone;
        public String sFax;
        }

        [WebMethod(Description="ADO 2.6 WebMethod Example")]
        public sCustomers[] GetCustomersOld()
        {
        ADODB.Connection cn = new ADODB.Connection();
        ADODB.Recordset rs = new ADODB.Recordset();
        String strSQL;
        int intRC;
        int intCnt;
        strSQL = "SELECT * FROM Customers";
        cn.Open("Provider=SQLOLEDB; Data Source=SERVER; Initial Catalog=Northwind;", "sa", null, 0);
        rs.Open(strSQL, cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, 0);
        intRC = rs.RecordCount;
        if (intRC < 1)
        {
        return null;
        }
        sCustomers[] c = new sCustomers[intRC];
        rs.MoveFirst();
        intCnt = 0;

        while (!rs.EOF)
        {
        c[intCnt].sCustomerID = rs.Fields["CustomerID"].Value.ToString();
        c[intCnt].sCompanyName = rs.Fields["CompanyName"].Value.ToString();
        c[intCnt].sContactName = rs.Fields["ContactName"].Value.ToString();
        c[intCnt].sContactTitle = rs.Fields["ContactTitle"].Value.ToString();
        c[intCnt].sAddress = rs.Fields["Address"].Value.ToString();
        c[intCnt].sCity = rs.Fields["City"].Value.ToString();
        c[intCnt].sRegion = rs.Fields["Region"].Value.ToString();
        c[intCnt].sPostalCode = rs.Fields["PostalCode"].Value.ToString();
        c[intCnt].sCountry = rs.Fields["Country"].Value.ToString();
        c[intCnt].sPhone = rs.Fields["Phone"].Value.ToString();
        c[intCnt].sFax = rs.Fields["Fax"].Value.ToString();
        rs.MoveNext();
        intCnt++;
        }
        return c;
        }

        [WebMethod(Description="ADO.NET WebMethod Example")]
        public DataSet GetCustomersNew()
        {
        DataSet ds = new DataSet();
        SQLConnection cn = new SQLConnection("localhost", "sa", "", "Northwind");
        cn.Open();
        SQLDataSetCommand cm = new SQLDataSetCommand("SELECT * FROM Customers", cn);
        cm.FillDataSet(ds, "Customers");
        return ds;
        }
        }
        }

        溫馨提示:喜歡本站的話,請收藏一下本站!

        本類教程下載

        系統下載排行

        主站蜘蛛池模板: 波多野结衣一区二区免费视频| 国产精品成人免费福利| 国产男女猛烈无遮挡免费视频| 久久亚洲精品国产亚洲老地址| 3344免费播放观看视频| 亚洲福利视频一区| 中文字幕免费在线观看| 亚洲成人网在线观看| 免费看国产成年无码AV片| 亚洲午夜无码久久久久小说 | 亚洲国产精品99久久久久久| 美女视频黄的全免费视频| 2019亚洲午夜无码天堂| 国产精品免费看久久久久| 杨幂最新免费特级毛片| 中文字幕亚洲综合久久男男| 国产va在线观看免费| 亚洲嫩草影院在线观看| 香蕉高清免费永久在线视频| 美女被免费视频网站a| 丁香五月亚洲综合深深爱| 免费国产污网站在线观看15| 亚洲免费观看在线视频| 国产大片91精品免费观看男同| 久久国产免费直播| 亚洲最大视频网站| 国产精品无码素人福利免费| 在线观看免费黄网站| 精品亚洲成在人线AV无码| 免费在线看片网站| 午夜视频在线免费观看| 亚洲AV女人18毛片水真多| 亚洲人JIZZ日本人| 国产在线国偷精品产拍免费| 三级片免费观看久久| 国产成人高清精品免费观看| 99久久亚洲精品无码毛片| 国产免费看插插插视频| 四虎国产成人永久精品免费 | 亚洲香蕉网久久综合影视| 久久国产精品成人片免费|