實現一個用戶端的DataSet-----ClientDataSetDataProvider.asmx

來源:互聯網
上載者:User
//
            // m_cmdAuthorsDelete
            //
            this.m_cmdAuthorsDelete.CommandText = @"DELETE FROM authors WHERE (au_id = @au_id) AND (address = @address OR @address1 IS NULL AND address IS NULL) AND (au_fname = @au_fname) AND (au_lname = @au_lname) AND (city = @city OR @city1 IS NULL AND city IS NULL) AND (contract = @contract) AND (phone = @phone) AND (state = @state OR @state1 IS NULL AND state IS NULL) AND (zip = @zip OR @zip1 IS NULL AND zip IS NULL)";
            this.m_cmdAuthorsDelete.Connection = this.m_con;
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@au_id", System.Data.SqlDbType.Char, 11, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "au_id", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@address", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "address", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@address1", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "address", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@au_fname", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "au_fname", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@au_lname", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "au_lname", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@city", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "city", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@city1", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "city", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@contract", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "contract", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@phone", System.Data.SqlDbType.Char, 12, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "phone", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@state", System.Data.SqlDbType.Char, 2, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "state", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@state1", System.Data.SqlDbType.Char, 2, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "state", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@zip", System.Data.SqlDbType.Char, 5, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "zip", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsDelete.Parameters.Add(new System.Data.SqlClient.SqlParameter("@zip1", System.Data.SqlDbType.Char, 5, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "zip", System.Data.DataRowVersion.Original, null));
            //
            // m_AuthorsAdapter
            //
            this.m_AuthorsAdapter.DeleteCommand = this.m_cmdAuthorsDelete;
            this.m_AuthorsAdapter.InsertCommand = this.m_cmdAuthorsInsert;
            this.m_AuthorsAdapter.SelectCommand = this.m_cmdAuthorsSelect;
            this.m_AuthorsAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "authors", new System.Data.Common.DataColumnMapping[] {
              new System.Data.Common.DataColumnMapping("au_id", "au_id"),
              new System.Data.Common.DataColumnMapping("au_lname", "au_lname"),
              new System.Data.Common.DataColumnMapping("au_fname", "au_fname"),
              new System.Data.Common.DataColumnMapping("phone", "phone"),
              new System.Data.Common.DataColumnMapping("address", "address"),
              new System.Data.Common.DataColumnMapping("city", "city"),
              new System.Data.Common.DataColumnMapping("state", "state"),
              new System.Data.Common.DataColumnMapping("zip", "zip"),
              new System.Data.Common.DataColumnMapping("contract", "contract")})});
            this.m_AuthorsAdapter.UpdateCommand = this.m_cmdAuthorsUpdate;
            //
            // m_PubsDataSet
            //
            this.m_PubsDataSet.DataSetName = "Pubs";
            this.m_PubsDataSet.Locale = new System.Globalization.CultureInfo("en-US");
            ((System.ComponentModel.ISupportInitialize)(this.m_PubsDataSet)).EndInit();

        }
        #endregion

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
        }

        [
            WebMethod
        ]
        public DataSet GetPubs()
        {
            m_con.Open();
            try
            {
                m_AuthorsAdapter.Fill(m_PubsDataSet);
            }
            finally
            {
                m_con.Close();
            }

            return m_PubsDataSet;
        }

        [
            WebMethod
        ]
        public void SaveChanges(DataSet dsPubs)
        {
            m_con.Open();
            try
            {
                m_AuthorsAdapter.Update(dsPubs);
            }
            finally
            {
                m_con.Close();
            }
        }
   &nb




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.