实现一个客户端的DataSet-----ClientDataSetDataProvider.asmx

来源:互联网 发布:淘宝上营业执照是外地 编辑:程序博客网 时间:2024/06/18 02:18
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Web;
using System.Web.Services;

namespace ClientSideDataSets
{
    public class ClientDataSetDataProvider : System.Web.Services.WebService
    {
        private System.Data.SqlClient.SqlDataAdapter m_AuthorsAdapter;
        private System.Data.SqlClient.SqlCommand m_cmdAuthorsSelect;
        private System.Data.SqlClient.SqlCommand m_cmdAuthorsInsert;
        private System.Data.SqlClient.SqlCommand m_cmdAuthorsUpdate;
        private System.Data.SqlClient.SqlCommand m_cmdAuthorsDelete;
        private System.Data.DataSet m_PubsDataSet;
        private System.Data.SqlClient.SqlConnection m_con;
    
        public ClientDataSetDataProvider()
        {
                      InitializeComponent();
        }

        #region Component Designer generated code
        private void InitializeComponent()
        {
            System.Collections.Specialized.NameValueCollection configurationAppSettings = System.Configuration.ConfigurationSettings.AppSettings;
            this.m_con = new System.Data.SqlClient.SqlConnection();
            this.m_cmdAuthorsSelect = new System.Data.SqlClient.SqlCommand();
            this.m_cmdAuthorsInsert = new System.Data.SqlClient.SqlCommand();
            this.m_cmdAuthorsUpdate = new System.Data.SqlClient.SqlCommand();
            this.m_cmdAuthorsDelete = new System.Data.SqlClient.SqlCommand();
            this.m_AuthorsAdapter = new System.Data.SqlClient.SqlDataAdapter();
            this.m_PubsDataSet = new System.Data.DataSet();
            ((System.ComponentModel.ISupportInitialize)(this.m_PubsDataSet)).BeginInit();
            //
            // m_con
            //
            this.m_con.ConnectionString = configurationAppSettings.Get("m_con.ConnectionString");
            //
            // m_cmdAuthorsSelect
            //
            this.m_cmdAuthorsSelect.CommandText = "SELECT au_id, au_lname, au_fname, phone, address, city, state, zip, contract FROM" +
                " authors";
            this.m_cmdAuthorsSelect.Connection = this.m_con;
            //
            // m_cmdAuthorsInsert
            //
            this.m_cmdAuthorsInsert.CommandText = @"INSERT INTO authors(au_id, au_lname, au_fname, phone, address, city, state, zip, contract) VALUES (@au_id, @au_lname, @au_fname, @phone, @address, @city, @state, @zip, @contract); SELECT au_id, au_lname, au_fname, phone, address, city, state, zip, contract FROM authors WHERE (au_id = @Select_au_id)";
            this.m_cmdAuthorsInsert.Connection = this.m_con;
            this.m_cmdAuthorsInsert.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.Current, null));
            this.m_cmdAuthorsInsert.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.Current, null));
            this.m_cmdAuthorsInsert.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.Current, null));
            this.m_cmdAuthorsInsert.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.Current, null));
            this.m_cmdAuthorsInsert.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.Current, null));
            this.m_cmdAuthorsInsert.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.Current, null));
            this.m_cmdAuthorsInsert.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.Current, null));
            this.m_cmdAuthorsInsert.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.Current, null));
            this.m_cmdAuthorsInsert.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.Current, null));
            this.m_cmdAuthorsInsert.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Select_au_id", System.Data.SqlDbType.Char, 11, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "au_id", System.Data.DataRowVersion.Current, null));
            //
            // m_cmdAuthorsUpdate
            //
            this.m_cmdAuthorsUpdate.CommandText = @"UPDATE authors SET au_id = @au_id, au_lname = @au_lname, au_fname = @au_fname, phone = @phone, address = @address, city = @city, state = @state, zip = @zip, contract = @contract WHERE (au_id = @Original_au_id) AND (address = @Original_address OR @Original_address1 IS NULL AND address IS NULL) AND (au_fname = @Original_au_fname) AND (au_lname = @Original_au_lname) AND (city = @Original_city OR @Original_city1 IS NULL AND city IS NULL) AND (contract = @Original_contract) AND (phone = @Original_phone) AND (state = @Original_state OR @Original_state1 IS NULL AND state IS NULL) AND (zip = @Original_zip OR @Original_zip1 IS NULL AND zip IS NULL); SELECT au_id, au_lname, au_fname, phone, address, city, state, zip, contract FROM authors WHERE (au_id = @Select_au_id)";
            this.m_cmdAuthorsUpdate.Connection = this.m_con;
            this.m_cmdAuthorsUpdate.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.Current, null));
            this.m_cmdAuthorsUpdate.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.Current, null));
            this.m_cmdAuthorsUpdate.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.Current, null));
            this.m_cmdAuthorsUpdate.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.Current, null));
            this.m_cmdAuthorsUpdate.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.Current, null));
            this.m_cmdAuthorsUpdate.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.Current, null));
            this.m_cmdAuthorsUpdate.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.Current, null));
            this.m_cmdAuthorsUpdate.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.Current, null));
            this.m_cmdAuthorsUpdate.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.Current, null));
            this.m_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_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_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_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_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_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_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_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_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_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_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_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_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_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_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_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_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_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_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_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_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_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_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_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_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_zip1", System.Data.SqlDbType.Char, 5, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "zip", System.Data.DataRowVersion.Original, null));
            this.m_cmdAuthorsUpdate.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Select_au_id", System.Data.SqlDbType.Char, 11, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "au_id", System.Data.DataRowVersion.Current, null));
          &n

实现一个客户端的DataSet-----ClientDataSetDataProvider.asmx.cs(1)';return true">
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>