Пример #1
0
            public static System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(System.Xml.Schema.XmlSchemaSet xs)
            {
                System.Xml.Schema.XmlSchemaComplexType type     = new System.Xml.Schema.XmlSchemaComplexType();
                System.Xml.Schema.XmlSchemaSequence    sequence = new System.Xml.Schema.XmlSchemaSequence();
                AccountsDataSet ds = new AccountsDataSet();

                xs.Add(ds.GetSchemaSerializable());
                System.Xml.Schema.XmlSchemaAny any1 = new System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                System.Xml.Schema.XmlSchemaAny any2 = new System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                System.Xml.Schema.XmlSchemaAttribute attribute1 = new System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                System.Xml.Schema.XmlSchemaAttribute attribute2 = new System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "BankAccountsDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                return(type);
            }
Пример #2
0
        public override System.Data.DataSet Clone()
        {
            AccountsDataSet cln = ((AccountsDataSet)(base.Clone()));

            cln.InitVars();
            return(cln);
        }
Пример #3
0
        public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs)
        {
            AccountsDataSet ds = new AccountsDataSet();

            System.Xml.Schema.XmlSchemaComplexType type     = new System.Xml.Schema.XmlSchemaComplexType();
            System.Xml.Schema.XmlSchemaSequence    sequence = new System.Xml.Schema.XmlSchemaSequence();
            xs.Add(ds.GetSchemaSerializable());
            System.Xml.Schema.XmlSchemaAny any = new System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            return(type);
        }
Пример #4
0
        void InitDataSource()
        {
            m_SelectCommand   = new SqlCommand();
            m_UpdateCommand   = new SqlCommand();
            m_Connection      = new SqlConnection();
            m_Adapter         = new SqlDataAdapter();
            m_AccountsDataSet = new AccountsDataSet();
            ((System.ComponentModel.ISupportInitialize)(m_AccountsDataSet)).BeginInit();

            // m_SelectCommand
            m_SelectCommand.CommandText = "SELECT Number, Balance, Name FROM dbo.BankAccounts";
            m_SelectCommand.Connection  = m_Connection;

            // m_UpdateCommand
            m_UpdateCommand.CommandText = @"UPDATE dbo.BankAccounts SET Number = @Number, Balance = @Balance, Name = @Name WHERE (Number = @Original_Number) AND (Balance = @Original_Balance OR @Original_Balance1 IS NULL AND Balance IS NULL) AND (Name = @Original_Name OR @Original_Name1 IS NULL AND Name IS NULL); SELECT Number, Balance, Name FROM dbo.BankAccounts WHERE (Number = @Select_Number)";
            m_UpdateCommand.Connection  = m_Connection;
            m_UpdateCommand.Parameters.Add(new SqlParameter("@Number", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Number", System.Data.DataRowVersion.Current, null));
            m_UpdateCommand.Parameters.Add(new SqlParameter("@Balance", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "Balance", System.Data.DataRowVersion.Current, null));
            m_UpdateCommand.Parameters.Add(new SqlParameter("@Name", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "Name", System.Data.DataRowVersion.Current, null));
            m_UpdateCommand.Parameters.Add(new SqlParameter("@Original_Number", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Number", System.Data.DataRowVersion.Original, null));
            m_UpdateCommand.Parameters.Add(new SqlParameter("@Original_Balance", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "Balance", System.Data.DataRowVersion.Original, null));
            m_UpdateCommand.Parameters.Add(new SqlParameter("@Original_Balance1", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "Balance", System.Data.DataRowVersion.Original, null));
            m_UpdateCommand.Parameters.Add(new SqlParameter("@Original_Name", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "Name", System.Data.DataRowVersion.Original, null));
            m_UpdateCommand.Parameters.Add(new SqlParameter("@Original_Name1", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "Name", System.Data.DataRowVersion.Original, null));
            m_UpdateCommand.Parameters.Add(new SqlParameter("@Select_Number", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Number", System.Data.DataRowVersion.Current, null));

            // m_Connection
            m_Connection.ConnectionString = "data source=(local);initial catalog=Bank Account System;integrated security=SSPI;per" +
                                            "sist security info=True;workstation id=(local);packet size=4096";

            // m_Adapter
            m_Adapter.SelectCommand = m_SelectCommand;
            m_Adapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
                new System.Data.Common.DataTableMapping("Table", "BankAccounts", new System.Data.Common.DataColumnMapping[] {
                    new System.Data.Common.DataColumnMapping("Number", "Number"),
                    new System.Data.Common.DataColumnMapping("Balance", "Balance"),
                    new System.Data.Common.DataColumnMapping("Name", "Name")
                })
            });
            m_Adapter.UpdateCommand = m_UpdateCommand;

            // m_AccountsDataSet
            m_AccountsDataSet.DataSetName = "AccountsDataSet";
            m_AccountsDataSet.Locale      = new System.Globalization.CultureInfo("en-US");
            m_AccountsDataSet.Namespace   = "http://www.tempuri.org/AccountsDataSet.xsd";
        }