首页 > 编程 > ASM > 正文

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

2024-07-21 02:27:45
字体:
来源:转载
供稿:网友
//
            // 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();
            }
        }
    }
}

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选