private void Form1_Load(object sender, EventArgs e) { DataSet1.ProductsDataTable dt = new DataSet1.ProductsDataTable(); DataSet1TableAdapters.ProductsTableAdapter da = new DataSet1TableAdapters.ProductsTableAdapter(); da.Fill(dt); dataGridView1.DataSource = dt; }
private void CreateAndFillDataSource(XtraReport report) { DataSet1 dataSet = new DataSet1(); DataSet1TableAdapters.ProductsTableAdapter adapt = new DataSet1TableAdapters.ProductsTableAdapter(); adapt.Fill(dataSet.Products); report.DataSource = dataSet; report.DataMember = dataSet.Products.TableName; }
static void Main(string[] args) { Product s = new Product(); List <Product> ss = new DataSet1TableAdapters.ProductsTableAdapter().GetData().Select( x => new Product { Id = x.Id, ProductName = x.ProductName, ProductDescription = x.ProductDescription }).ToList(); }
private void button1_Click(object sender, EventArgs e) { DataSet1.ProductsDataTable dt = new DataSet1.ProductsDataTable(); DataSet1TableAdapters.ProductsTableAdapter da = new DataSet1TableAdapters.ProductsTableAdapter(); da.FillByProductID(dt, 1); DataTable dt1 = da.GetDataByProductID(1); string prodname = dt1.Rows[0][1].ToString(); string prodprice = dt1.Rows[0]["UnitPrice"].ToString(); MessageBox.Show(prodname); MessageBox.Show(prodprice); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { string resourceFileName = "XtraReport1.resx"; this.Detail = new DevExpress.XtraReports.UI.DetailBand(); this.xrLabel4 = new DevExpress.XtraReports.UI.XRLabel(); this.xrPictureBox1 = new DevExpress.XtraReports.UI.XRPictureBox(); this.xrLabel2 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel1 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel5 = new DevExpress.XtraReports.UI.XRLabel(); this.dataSet11 = new DataSet1(); this.DetailReport = new DevExpress.XtraReports.UI.DetailReportBand(); this.Detail1 = new DevExpress.XtraReports.UI.DetailBand(); this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel(); this.productsTableAdapter1 = new DataSet1TableAdapters.ProductsTableAdapter(); this.categoriesTableAdapter1 = new DataSet1TableAdapters.CategoriesTableAdapter(); this.ReportHeader = new DevExpress.XtraReports.UI.ReportHeaderBand(); ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // // Detail // this.Detail.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { this.xrLabel4, this.xrPictureBox1, this.xrLabel2, this.xrLabel1 }); this.Detail.Height = 69; this.Detail.Name = "Detail"; this.Detail.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F); this.Detail.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft; // // xrLabel4 // this.xrLabel4.BackColor = System.Drawing.Color.LightBlue; this.xrLabel4.Location = new System.Drawing.Point(0, 0); this.xrLabel4.Name = "xrLabel4"; this.xrLabel4.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.xrLabel4.Size = new System.Drawing.Size(17, 17); this.xrLabel4.StylePriority.UseBackColor = false; this.xrLabel4.Text = "-"; this.xrLabel4.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; this.xrLabel4.BeforePrint += new System.Drawing.Printing.PrintEventHandler(this.xrLabel4_BeforePrint); // // xrPictureBox1 // this.xrPictureBox1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Image", null, "Categories.Picture", "") }); this.xrPictureBox1.Location = new System.Drawing.Point(483, 0); this.xrPictureBox1.Name = "xrPictureBox1"; this.xrPictureBox1.Size = new System.Drawing.Size(158, 58); this.xrPictureBox1.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage; // // xrLabel2 // this.xrLabel2.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "Categories.Description", "") }); this.xrLabel2.Location = new System.Drawing.Point(75, 33); this.xrLabel2.Name = "xrLabel2"; this.xrLabel2.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.xrLabel2.Size = new System.Drawing.Size(250, 25); this.xrLabel2.Text = "xrLabel2"; // // xrLabel1 // this.xrLabel1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "Categories.CategoryName", "") }); this.xrLabel1.Location = new System.Drawing.Point(75, 0); this.xrLabel1.Name = "xrLabel1"; this.xrLabel1.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.xrLabel1.Size = new System.Drawing.Size(158, 25); this.xrLabel1.Text = "xrLabel1"; this.xrLabel1.Font = new Font(this.Font.FontFamily.ToString(), 12, FontStyle.Bold); // // xrLabel5 // this.xrLabel5.Font = new System.Drawing.Font("Times New Roman", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.xrLabel5.ForeColor = System.Drawing.Color.Blue; this.xrLabel5.Location = new System.Drawing.Point(275, 0); this.xrLabel5.Name = "xrLabel5"; this.xrLabel5.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.xrLabel5.Size = new System.Drawing.Size(100, 33); this.xrLabel5.StylePriority.UseFont = false; this.xrLabel5.StylePriority.UseForeColor = false; this.xrLabel5.Text = "Catalog"; // // dataSet11 // this.dataSet11.DataSetName = "DataSet1"; this.dataSet11.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // DetailReport // this.DetailReport.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { this.Detail1 }); this.DetailReport.DataMember = "Products"; this.DetailReport.DataSource = this.dataSet11; this.DetailReport.Level = 0; this.DetailReport.Name = "DetailReport"; this.DetailReport.BeforePrint += new System.Drawing.Printing.PrintEventHandler(this.DetailReport_BeforePrint); // // Detail1 // this.Detail1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { this.xrLabel3 }); this.Detail1.Height = 25; this.Detail1.Name = "Detail1"; // // xrLabel3 // this.xrLabel3.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { new DevExpress.XtraReports.UI.XRBinding("Text", null, "Products.ProductName", "") }); this.xrLabel3.Location = new System.Drawing.Point(225, 0); this.xrLabel3.Name = "xrLabel3"; this.xrLabel3.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.xrLabel3.Size = new System.Drawing.Size(192, 25); this.xrLabel3.Text = "xrLabel3"; // // productsTableAdapter1 // this.productsTableAdapter1.ClearBeforeFill = true; // // categoriesTableAdapter1 // this.categoriesTableAdapter1.ClearBeforeFill = true; // // ReportHeader // this.ReportHeader.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { this.xrLabel5 }); this.ReportHeader.Height = 33; this.ReportHeader.Name = "ReportHeader"; // // XtraReport1 // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { this.Detail, this.DetailReport, this.ReportHeader }); this.DataAdapter = this.categoriesTableAdapter1; this.DataSource = this.dataSet11; this.Version = "8.1"; ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); }