problem z UpdateCommand DataGrid

0

Witam Państwa, chciałbym się zwrócić z problemem który dreczy mnie od 3 dni, a niestety na rozwiązanie go mam czas do wtorku, (jeszcze) programowanie nie idzie mi zbyt biegle stad prośba o pomoc do Państwa.

Napisałem w pracy aplikacje bazodanową (SQL2005 + C# - desktop aplication), kataloguje ona imie, nazwisko, obywatelstwo, nrAkt oraz rok i wszystko wyświetla w DataGridzie. Kodu jest stosunkowo mało bo wszystko stworzyłem przy pomocy wizardów visual studio 2005, wszystko dział, zrobiłem procedury w bazie dzięki którym szukam po określonych kryteriach i do tego momentu jest ok ALE....

Gdy chce poprawić jakiś wiersz DataGrida owszem pozwoli mi ale przy zapisaniu zmian do bazy wyskakuje mi błąd że nie mam UpdateCommand. Rozumiem że nie mam metody na zrobienie updata, napisałem stored procedure do tego i w bazie to działa, ale w programie niestety już nie, Czy ktoś może zerknąć na moj kod i naprowadzić mnie jak to zrobić(ew napisać ale byłbym wdzieczny za wytłumaczenie co i jak - znalazłem mnÓstwo przykładów na updatecommand ale one smigaja z aplikacja co jest pisana od podstaw a nie robiona wizardami... bardzo proszę o pomoc - oto kod

<? using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; using System.Drawing.Printing; namespace DBAplication { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.tableTableAdapter.Fill(this.cudzDataSet.Table); } private void Form1_Close(object sender, FormClosingEventArgs e) { switch(MessageBox.Show("Wychodzisz!? Zapisz, Twoja decyzja:\nZapisać zmiany przed wyjściem?", "Wyjście z programu", MessageBoxButtons.YesNo)) { case DialogResult.Yes: this.tableTableAdapter.Update(cudzDataSet.Table); MessageBox.Show("Dane zostały poprawnie zapisane do bazy", "Dziękuje za współprace"); break; case DialogResult.No: break; } } private void Data_Error(object sender, DataGridViewDataErrorEventArgs e) { MessageBox.Show("Nie wprowadzono poprawnych danych\n\ndata muśi być w formacie np: 1996", "Błąd"); } private void saveToolStripMenuItem_Click(object sender, EventArgs e) { this.tableTableAdapter.Update(cudzDataSet.Table); MessageBox.Show("Dane zostały poprawnie wprowadzone do bazy"); } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); } private void fillByToolStripButton_Click(object sender, EventArgs e) { try { this.tableTableAdapter.FillBy(this.cudzDataSet.Table, parToolStripTextBox.Text); } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } } private void szukaj_po_ImieniuToolStripButton_Click(object sender, EventArgs e) { try { this.tableTableAdapter.Szukaj_po_Imieniu(this.cudzDataSet.Table, parToolStripTextBox1.Text); } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } } private void szukaj_po_Nr_AktToolStripButton_Click(object sender, EventArgs e) { try { this.tableTableAdapter.Szukaj_po_Nr_Akt(this.cudzDataSet.Table, parToolStripTextBox2.Text); } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } } private void selectAllToolStripButton_Click(object sender, EventArgs e) { try { this.tableTableAdapter.selectAll(this.cudzDataSet.Table); } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } } private void UpdateData(object sender, EventArgs e) { try { for (int i = 0; i <= dataGridView1.Rows.Count; i++) { this.tableTableAdapter.UpdateQuery(); } } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } } private void printPreviewToolStripMenuItem_Click(object sender, EventArgs e) { dataGridViewPrintControl1.DataGridView = dataGridView1; dataGridViewPrintControl1.PrintPreview(); } private void toolStripMenuItem1_Click(object sender, EventArgs e) { dataGridViewPrintControl1.DataGridView = dataGridView1; dataGridViewPrintControl1.PageSetup(); } private void printToolStripMenuItem_Click(object sender, EventArgs e) { dataGridViewPrintControl1.DataGridView = dataGridView1; dataGridViewPrintControl1.Print(); } private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { AboutBox1 about = new AboutBox1(); about.ShowDialog(); } } } ?>
0

Obawiam się, że kod, który wysłałeś nie wystarczy do znalezienia rozwiązania. Potrzebny bylby jeszcze Designer.cs, a najlepiej cały projekt. Tak żebym mógł odtworzyć tą sytuację u siebie. Nie musi to być w pełni funkcjonalny kod, ale musi mieć te partie kodu ktore są odpowiedzialne za wypelnianie grida i za ustawianie adaptera.

0

w takim razie w przeciągu 1 h wkleje designer.cs, ew moge przesłać cały projekt tylko poprosze o adres email. Bardzo dziękuje za zainteresowanie

0

Designer.cs a cały projekt po podaniu @

<? namespace DBAplication { partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.Opcje = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.printToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.help = new System.Windows.Forms.ToolStripMenuItem(); this.Info = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fillByToolStrip = new System.Windows.Forms.ToolStrip(); this.parToolStripLabel = new System.Windows.Forms.ToolStripLabel(); this.parToolStripTextBox = new System.Windows.Forms.ToolStripTextBox(); this.fillByToolStripButton = new System.Windows.Forms.ToolStripButton(); this.szukaj_po_ImieniuToolStrip = new System.Windows.Forms.ToolStrip(); this.parToolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); this.parToolStripTextBox1 = new System.Windows.Forms.ToolStripTextBox(); this.szukaj_po_ImieniuToolStripButton = new System.Windows.Forms.ToolStripButton(); this.szukaj_po_Nr_AktToolStrip = new System.Windows.Forms.ToolStrip(); this.parToolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); this.parToolStripTextBox2 = new System.Windows.Forms.ToolStripTextBox(); this.szukaj_po_Nr_AktToolStripButton = new System.Windows.Forms.ToolStripButton(); this.selectAllToolStrip = new System.Windows.Forms.ToolStrip(); this.selectAllToolStripButton = new System.Windows.Forms.ToolStripButton(); this.dataTableBindingSource = new System.Windows.Forms.BindingSource(this.components); this.printDocument1 = new System.Drawing.Printing.PrintDocument(); this.dataGridViewPrintControl1 = new Teroid.DataGridViewPrintControl.DataGridViewPrintControl(); this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.rokDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tableBindingSource = new System.Windows.Forms.BindingSource(this.components); this.cudzDataSet = new DBAplication.cudzDataSet(); this.tableTableAdapter = new DBAplication.cudzDataSetTableAdapters.TableTableAdapter(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.menuStrip1.SuspendLayout(); this.fillByToolStrip.SuspendLayout(); this.szukaj_po_ImieniuToolStrip.SuspendLayout(); this.szukaj_po_Nr_AktToolStrip.SuspendLayout(); this.selectAllToolStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataTableBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tableBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cudzDataSet)).BeginInit(); this.SuspendLayout(); // // dataGridView1 // this.dataGridView1.AllowUserToOrderColumns = true; this.dataGridView1.AutoGenerateColumns = false; this.dataGridView1.BackgroundColor = System.Drawing.Color.PaleGreen; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridViewTextBoxColumn1, this.dataGridViewTextBoxColumn2, this.dataGridViewTextBoxColumn3, this.dataGridViewTextBoxColumn4, this.dataGridViewTextBoxColumn5, this.rokDataGridViewTextBoxColumn}); this.dataGridView1.DataSource = this.tableBindingSource; this.dataGridView1.Location = new System.Drawing.Point(0, 123); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ShowCellErrors = false; this.dataGridView1.ShowCellToolTips = false; this.dataGridView1.ShowEditingIcon = false; this.dataGridView1.ShowRowErrors = false; this.dataGridView1.Size = new System.Drawing.Size(666, 535); this.dataGridView1.TabIndex = 1; this.dataGridView1.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.Data_Error); // // menuStrip1 // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Opcje, this.help}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(666, 24); this.menuStrip1.TabIndex = 2; this.menuStrip1.Text = "menuStrip1"; // // Opcje // this.Opcje.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripSeparator, this.saveToolStripMenuItem, this.toolStripSeparator1, this.printToolStripMenuItem, this.printPreviewToolStripMenuItem, this.toolStripMenuItem1, this.toolStripSeparator2, this.exitToolStripMenuItem}); this.Opcje.Name = "Opcje"; this.Opcje.Size = new System.Drawing.Size(47, 20); this.Opcje.Text = "&Opcje"; // // toolStripSeparator // this.toolStripSeparator.Name = "toolStripSeparator"; this.toolStripSeparator.Size = new System.Drawing.Size(219, 6); // // saveToolStripMenuItem // this.saveToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image"))); this.saveToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); this.saveToolStripMenuItem.Size = new System.Drawing.Size(222, 22); this.saveToolStripMenuItem.Text = "&Zapisz dane do Bazy"; this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(219, 6); // // printToolStripMenuItem // this.printToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printToolStripMenuItem.Image"))); this.printToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.printToolStripMenuItem.Name = "printToolStripMenuItem"; this.printToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); this.printToolStripMenuItem.Size = new System.Drawing.Size(222, 22); this.printToolStripMenuItem.Text = "&Drukuj"; this.printToolStripMenuItem.Click += new System.EventHandler(this.printToolStripMenuItem_Click); // // printPreviewToolStripMenuItem // this.printPreviewToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printPreviewToolStripMenuItem.Image"))); this.printPreviewToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem"; this.printPreviewToolStripMenuItem.Size = new System.Drawing.Size(222, 22); this.printPreviewToolStripMenuItem.Text = "Podgląd w&ydruku"; this.printPreviewToolStripMenuItem.Click += new System.EventHandler(this.printPreviewToolStripMenuItem_Click); // // toolStripMenuItem1 // this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Size = new System.Drawing.Size(222, 22); this.toolStripMenuItem1.Text = "&Opcje wydruku"; this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Size = new System.Drawing.Size(219, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z))); this.exitToolStripMenuItem.Size = new System.Drawing.Size(222, 22); this.exitToolStripMenuItem.Text = "Z&akończ"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // // help // this.help.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Info, this.toolStripSeparator5, this.aboutToolStripMenuItem}); this.help.Name = "help"; this.help.Size = new System.Drawing.Size(51, 20); this.help.Text = "&Pomoc"; // // Info // this.Info.Name = "Info"; this.Info.Size = new System.Drawing.Size(195, 22); this.Info.Text = "&Informacje o programie"; // // toolStripSeparator5 // this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Size = new System.Drawing.Size(192, 6); // // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; this.aboutToolStripMenuItem.Size = new System.Drawing.Size(195, 22); this.aboutToolStripMenuItem.Text = "&Autor..."; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // // fillByToolStrip // this.fillByToolStrip.BackColor = System.Drawing.Color.LightGreen; this.fillByToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.parToolStripLabel, this.parToolStripTextBox, this.fillByToolStripButton}); this.fillByToolStrip.Location = new System.Drawing.Point(0, 24); this.fillByToolStrip.Name = "fillByToolStrip"; this.fillByToolStrip.Size = new System.Drawing.Size(666, 25); this.fillByToolStrip.TabIndex = 3; this.fillByToolStrip.Text = "fillByToolStrip"; // // parToolStripLabel // this.parToolStripLabel.Name = "parToolStripLabel"; this.parToolStripLabel.Size = new System.Drawing.Size(90, 22); this.parToolStripLabel.Text = "podaj nazwisko: "; // // parToolStripTextBox // this.parToolStripTextBox.Name = "parToolStripTextBox"; this.parToolStripTextBox.Size = new System.Drawing.Size(100, 25); // // fillByToolStripButton // this.fillByToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.fillByToolStripButton.Name = "fillByToolStripButton"; this.fillByToolStripButton.Size = new System.Drawing.Size(105, 22); this.fillByToolStripButton.Text = "Szukaj po nazwisku"; this.fillByToolStripButton.Click += new System.EventHandler(this.fillByToolStripButton_Click); // // szukaj_po_ImieniuToolStrip // this.szukaj_po_ImieniuToolStrip.BackColor = System.Drawing.Color.LightGreen; this.szukaj_po_ImieniuToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.parToolStripLabel1, this.parToolStripTextBox1, this.szukaj_po_ImieniuToolStripButton}); this.szukaj_po_ImieniuToolStrip.Location = new System.Drawing.Point(0, 49); this.szukaj_po_ImieniuToolStrip.Name = "szukaj_po_ImieniuToolStrip"; this.szukaj_po_ImieniuToolStrip.Size = new System.Drawing.Size(666, 25); this.szukaj_po_ImieniuToolStrip.TabIndex = 4; this.szukaj_po_ImieniuToolStrip.Text = "szukaj_po_ImieniuToolStrip"; // // parToolStripLabel1 // this.parToolStripLabel1.Name = "parToolStripLabel1"; this.parToolStripLabel1.Size = new System.Drawing.Size(90, 22); this.parToolStripLabel1.Text = "podaj imie: "; // // parToolStripTextBox1 // this.parToolStripTextBox1.Name = "parToolStripTextBox1"; this.parToolStripTextBox1.Size = new System.Drawing.Size(100, 25); // // szukaj_po_ImieniuToolStripButton // this.szukaj_po_ImieniuToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.szukaj_po_ImieniuToolStripButton.Name = "szukaj_po_ImieniuToolStripButton"; this.szukaj_po_ImieniuToolStripButton.Size = new System.Drawing.Size(98, 22); this.szukaj_po_ImieniuToolStripButton.Text = "Szukaj po Imieniu"; this.szukaj_po_ImieniuToolStripButton.Click += new System.EventHandler(this.szukaj_po_ImieniuToolStripButton_Click); // // szukaj_po_Nr_AktToolStrip // this.szukaj_po_Nr_AktToolStrip.BackColor = System.Drawing.Color.LightGreen; this.szukaj_po_Nr_AktToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.parToolStripLabel2, this.parToolStripTextBox2, this.szukaj_po_Nr_AktToolStripButton}); this.szukaj_po_Nr_AktToolStrip.Location = new System.Drawing.Point(0, 74); this.szukaj_po_Nr_AktToolStrip.Name = "szukaj_po_Nr_AktToolStrip"; this.szukaj_po_Nr_AktToolStrip.Size = new System.Drawing.Size(666, 25); this.szukaj_po_Nr_AktToolStrip.TabIndex = 5; this.szukaj_po_Nr_AktToolStrip.Text = "szukaj_po_Nr_AktToolStrip"; // // parToolStripLabel2 // this.parToolStripLabel2.Name = "parToolStripLabel2"; this.parToolStripLabel2.Size = new System.Drawing.Size(89, 22); this.parToolStripLabel2.Text = "podaj numer akt:"; // // parToolStripTextBox2 // this.parToolStripTextBox2.Name = "parToolStripTextBox2"; this.parToolStripTextBox2.Size = new System.Drawing.Size(100, 25); // // szukaj_po_Nr_AktToolStripButton // this.szukaj_po_Nr_AktToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.szukaj_po_Nr_AktToolStripButton.Name = "szukaj_po_Nr_AktToolStripButton"; this.szukaj_po_Nr_AktToolStripButton.Size = new System.Drawing.Size(89, 22); this.szukaj_po_Nr_AktToolStripButton.Text = "Szukaj po nr akt"; this.szukaj_po_Nr_AktToolStripButton.Click += new System.EventHandler(this.szukaj_po_Nr_AktToolStripButton_Click); // // selectAllToolStrip // this.selectAllToolStrip.BackColor = System.Drawing.Color.LightCoral; this.selectAllToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.selectAllToolStripButton}); this.selectAllToolStrip.Location = new System.Drawing.Point(0, 99); this.selectAllToolStrip.Name = "selectAllToolStrip"; this.selectAllToolStrip.Size = new System.Drawing.Size(666, 25); this.selectAllToolStrip.TabIndex = 6; this.selectAllToolStrip.Text = "selectAllToolStrip"; // // selectAllToolStripButton // this.selectAllToolStripButton.BackColor = System.Drawing.Color.Transparent; this.selectAllToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.selectAllToolStripButton.Name = "selectAllToolStripButton"; this.selectAllToolStripButton.Size = new System.Drawing.Size(120, 22); this.selectAllToolStripButton.Text = "Pokaż wszystkie Dane"; this.selectAllToolStripButton.Click += new System.EventHandler(this.selectAllToolStripButton_Click); // // dataGridViewPrintControl1 // this.dataGridViewPrintControl1.DataGridView = this.dataGridView1; this.dataGridViewPrintControl1.PageFooter = "[Roman Haligowski]"; this.dataGridViewPrintControl1.PageFooterColor = System.Drawing.Color.Black; this.dataGridViewPrintControl1.PageFooterFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.dataGridViewPrintControl1.PageHeader = "[Baza Cudzoziemców]"; this.dataGridViewPrintControl1.PageHeaderColor = System.Drawing.Color.Black; this.dataGridViewPrintControl1.PageHeaderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.dataGridViewPrintControl1.PageNumberColor = System.Drawing.Color.Black; this.dataGridViewPrintControl1.PageNumberFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.dataGridViewPrintControl1.PageNumberFormat = "Strona # z #"; // // dataGridViewTextBoxColumn1 // this.dataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader; this.dataGridViewTextBoxColumn1.DataPropertyName = "L_p_"; this.dataGridViewTextBoxColumn1.HeaderText = "L.p."; this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; this.dataGridViewTextBoxColumn1.ReadOnly = true; this.dataGridViewTextBoxColumn1.Width = 48; // // dataGridViewTextBoxColumn2 // this.dataGridViewTextBoxColumn2.DataPropertyName = "Nazwisko"; this.dataGridViewTextBoxColumn2.HeaderText = "Nazwisko"; this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; // // dataGridViewTextBoxColumn3 // this.dataGridViewTextBoxColumn3.DataPropertyName = "Imie"; this.dataGridViewTextBoxColumn3.HeaderText = "Imie"; this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; // // dataGridViewTextBoxColumn4 // this.dataGridViewTextBoxColumn4.DataPropertyName = "Obywatelstwo"; this.dataGridViewTextBoxColumn4.HeaderText = "Obywatelstwo"; this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; // // dataGridViewTextBoxColumn5 // this.dataGridViewTextBoxColumn5.DataPropertyName = "Nr Akt"; this.dataGridViewTextBoxColumn5.HeaderText = "Nr Akt"; this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5"; // // rokDataGridViewTextBoxColumn // this.rokDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; this.rokDataGridViewTextBoxColumn.DataPropertyName = "Rok"; this.rokDataGridViewTextBoxColumn.HeaderText = "Rok"; this.rokDataGridViewTextBoxColumn.Name = "rokDataGridViewTextBoxColumn"; this.rokDataGridViewTextBoxColumn.Width = 48; // // tableBindingSource // this.tableBindingSource.DataMember = "Table"; this.tableBindingSource.DataSource = this.cudzDataSet; // // cudzDataSet // this.cudzDataSet.DataSetName = "cudzDataSet"; this.cudzDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // tableTableAdapter // this.tableTableAdapter.ClearBeforeFill = true; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.PaleGreen; this.ClientSize = new System.Drawing.Size(666, 658); this.Controls.Add(this.selectAllToolStrip); this.Controls.Add(this.szukaj_po_Nr_AktToolStrip); this.Controls.Add(this.szukaj_po_ImieniuToolStrip); this.Controls.Add(this.fillByToolStrip); this.Controls.Add(this.dataGridView1); this.Controls.Add(this.menuStrip1); this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.MainMenuStrip = this.menuStrip1; this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Baza Cudzoziemców "; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_Close); this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.fillByToolStrip.ResumeLayout(false); this.fillByToolStrip.PerformLayout(); this.szukaj_po_ImieniuToolStrip.ResumeLayout(false); this.szukaj_po_ImieniuToolStrip.PerformLayout(); this.szukaj_po_Nr_AktToolStrip.ResumeLayout(false); this.szukaj_po_Nr_AktToolStrip.PerformLayout(); this.selectAllToolStrip.ResumeLayout(false); this.selectAllToolStrip.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataTableBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tableBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cudzDataSet)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.DataGridView dataGridView1; private System.Windows.Forms.BindingSource dataTableBindingSource; private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem Opcje; private System.Windows.Forms.ToolStripSeparator toolStripSeparator; private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem printToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem printPreviewToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem help; private System.Windows.Forms.ToolStripMenuItem Info; private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; private cudzDataSet cudzDataSet; private System.Windows.Forms.BindingSource tableBindingSource; private DBAplication.cudzDataSetTableAdapters.TableTableAdapter tableTableAdapter; private System.Windows.Forms.ToolStrip fillByToolStrip; private System.Windows.Forms.ToolStripLabel parToolStripLabel; private System.Windows.Forms.ToolStripTextBox parToolStripTextBox; private System.Windows.Forms.ToolStripButton fillByToolStripButton; private System.Windows.Forms.ToolStrip szukaj_po_ImieniuToolStrip; private System.Windows.Forms.ToolStripLabel parToolStripLabel1; private System.Windows.Forms.ToolStripTextBox parToolStripTextBox1; private System.Windows.Forms.ToolStripButton szukaj_po_ImieniuToolStripButton; private System.Windows.Forms.ToolStrip szukaj_po_Nr_AktToolStrip; private System.Windows.Forms.ToolStripLabel parToolStripLabel2; private System.Windows.Forms.ToolStripTextBox parToolStripTextBox2; private System.Windows.Forms.ToolStripButton szukaj_po_Nr_AktToolStripButton; private System.Windows.Forms.ToolStrip selectAllToolStrip; private System.Windows.Forms.ToolStripButton selectAllToolStripButton; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5; private System.Windows.Forms.DataGridViewTextBoxColumn rokDataGridViewTextBoxColumn; private System.Drawing.Printing.PrintDocument printDocument1; private Teroid.DataGridViewPrintControl.DataGridViewPrintControl dataGridViewPrintControl1; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; } } ?>
0

Załóż sobie konto na 4programmers to Ci wyślę adres mejla na PW ;)

0

założyłem konto ,wysłałem Ci wiadomosc a na emaila projekt :)

0

witam ,dalej się męcze, znalazłem pdf z opisem ... wklejam

private void daCategories_RowUpdate(object sender,3. System.Data.SqlClient.SqlRowUpdatedEventArgs e)
{
string strMsg;

strMsg = "\nUpdate Completed.";
this.txtMessages.Text += strMsg;
}
Add the following code to connect the event handler in the class
description:
this.daCategories.RowUpdated += new System.Data.SqlClient.SqlRowUpdatedEventHandler(this.daCategories_RowUpdated);

nie rozumiem gdzie wkleic ten ostatni wiersz kodu, poza tym moj DataAdapter nie ma metody RowUpdated.. dalej proszę o pomoc

0

Nie wiem czy ide w dobrym kierunku ale UpdateQuery mam tylko w DataSet, program się "najprawdopodobniej mi wysypuje bo nie robie Update na danych w Bazie"

UPDATE Table SET imie = 'imie', nazwisko = 'nazwisko'

w query builderze np przy takim updacie nie wywala błędu, ale nie wiem czy zamist 'nazwisko' nie powinienem dać (dataGridColumnNazwisko) ????

1 użytkowników online, w tym zalogowanych: 0, gości: 1