Example #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();
                dsAddressList ds = new dsAddressList();

                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 = "dtAddressListDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                return(type);
            }
Example #2
0
        public override System.Data.DataSet Clone()
        {
            dsAddressList cln = ((dsAddressList)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Example #3
0
        public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs)
        {
            dsAddressList ds = new dsAddressList();

            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);
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            string        connectionString = @"Data Source=TANVIR\SQLEXPRESS;Initial Catalog=Sample;Integrated Security=True";
            SqlConnection connection       = new SqlConnection(connectionString);
            string        sql     = "select * from AddrressLine";
            SqlCommand    command = new SqlCommand(sql, connection);
            SqlDataReader dr;
            DataSet       ds = new dsAddressList();

            try
            {
                connection.Open();
                dr = command.ExecuteReader();
                ds.Tables[0].Load(dr);
                dr.Close();
                //connection.Close();

                reportViewer1.LocalReport.ReportEmbeddedResource = "AddressList.rptAddressList.rdlc";
                // you need to set this to show multi column output in report viewer
                reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
                // set the zoom mode of report viewer to 100%
                reportViewer1.ZoomMode    = ZoomMode.Percent;
                reportViewer1.ZoomPercent = 100;

                //prepare report data source
                ReportDataSource rds = new ReportDataSource();
                rds.Name  = "dsAddressList_dtAddressList";
                rds.Value = ds.Tables[0];
                reportViewer1.LocalReport.DataSources.Add(rds);
                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //check if connection is still open then attempt to close it
                if (connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            //declare connection string, please substitute DataSource with your Server name
            string cnString = "Data Source=(local);Initial Catalog=RealWorld;Integrated Security=SSPI;";

            //declare Connection, command and other related objects
            SqlConnection conReport = new SqlConnection(cnString);
            SqlCommand    cmdReport = new SqlCommand();
            SqlDataReader drReport;
            DataSet       dsReport = new dsAddressList();

            try
            {
                //open connection
                conReport.Open();

                //prepare connection object to get the data through reader and populate into dataset
                cmdReport.CommandType = CommandType.Text;
                cmdReport.Connection  = conReport;
                cmdReport.CommandText = "Select * FROM dbo.AddressList";

                //read data from command object
                drReport = cmdReport.ExecuteReader();

                //load data directly from reader to dataset
                dsReport.Tables[0].Load(drReport);

                //close reader and connection
                drReport.Close();
                conReport.Close();

                //provide local report information to viewer
                reportViewer1.LocalReport.ReportEmbeddedResource = "AddressList.rptAddressList.rdlc";

                // you need to set this to show multi column output in report viewer
                reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);

                // set the zoom mode of report viewer to 100%
                reportViewer1.ZoomMode    = ZoomMode.Percent;
                reportViewer1.ZoomPercent = 100;

                //prepare report data source
                ReportDataSource rds = new ReportDataSource();
                rds.Name  = "dsAddressList_dtAddressList";
                rds.Value = dsReport.Tables[0];
                reportViewer1.LocalReport.DataSources.Add(rds);

                //load report viewer
                reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                //display generic error message back to user
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //check if connection is still open then attempt to close it
                if (conReport.State == ConnectionState.Open)
                {
                    conReport.Close();
                }
            }
        }