首页 > 编程 > ASM > 正文

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

2024-07-21 02:16:43
字体:
来源:转载
供稿:网友

最大的网站源码资源下载站,

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));
            
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选