none
csharp datagridview changes not committing to azure sql

    Pertanyaan

  • Hi i have a csharp project which connects to an azure sql database with several datagridviews. when i make changes to the data in the datagridviews and navigate away from the row, it is my expectation that my changes would be committed to the database but this does not happen. No insert command is sent to the database. When i close and reopen the application my changes have been reverted to their previous state. this is making me crazy, what in the world am i missing??

    I wanted to include some snippets to help figure this out: first of all the table that we are talking about has columns ID, w, l, m, s, a, f, s. All of them are guids, but the ID column is the PK and has a default value of newid()  

    form1.designer.cs

    ...
    
                this.dataGridView16 = new System.Windows.Forms.DataGridView();
                this.wTestBindingSource = new System.Windows.Forms.BindingSource(this.components);
    ...
    
                ((System.ComponentModel.ISupportInitialize)(this.dataGridView16)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this.wTestBindingSource)).BeginInit();
                this.WTestInstance.SuspendLayout();
    ...
    
                this.dataGridView16.AutoGenerateColumns = false;
                this.dataGridView16.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                this.dataGridView16.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                this.iDDataGridViewTextBoxColumn15,
                this.wDataGridViewTextBoxColumn6,
                this.lDataGridViewTextBoxColumn1,
                this.mDataGridViewTextBoxColumn1,
                this.sDataGridViewTextBoxColumn1,
                this.aDataGridViewTextBoxColumn,
                this.fDataGridViewTextBoxColumn,
                this.sDataGridViewTextBoxColumn});
                this.dataGridView16.DataSource = this.wTestBindingSource;
                this.dataGridView16.Dock = System.Windows.Forms.DockStyle.Fill;
                this.dataGridView16.Location = new System.Drawing.Point(0, 0);
                this.dataGridView16.Name = "dataGridView16";
                this.dataGridView16.Size = new System.Drawing.Size(1484, 747);
                this.dataGridView16.TabIndex = 0;            
                this.dataGridView16.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView16_CellContentClick);
                this.dataGridView16.DefaultValuesNeeded += new System.Windows.Forms.DataGridViewRowEventHandler(this.dataGridView16_DefaultValuesNeeded);
                // 
                // wTestBindingSource
                // 
                this.wTestBindingSource.DataMember = "WTest";
                this.wTestBindingSource.DataSource = this.pDataSet;
                this.wTestBindingSource.CurrentChanged += new System.EventHandler(this.wTestBindingSource_CurrentChanged);
    ...
    
                ((System.ComponentModel.ISupportInitialize)(this.dataGridView16)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this.wTestBindingSource)).EndInit();
                this.WTestInstance.ResumeLayout(false);
    ...

    pDataSet.Designer.cs

    /// <summary>
        ///Represents the connection and commands used to retrieve and save data.
        ///</summary>
        [global::System.ComponentModel.DesignerCategoryAttribute("code")]
        [global::System.ComponentModel.ToolboxItem(true)]
        [global::System.ComponentModel.DataObjectAttribute(true)]
        [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
            ", Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
        [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
        public partial class WTestTableAdapter : global::System.ComponentModel.Component {
            
            private global::System.Data.SqlClient.SqlDataAdapter _adapter;
            
            private global::System.Data.SqlClient.SqlConnection _connection;
            
            private global::System.Data.SqlClient.SqlTransaction _transaction;
            
            private global::System.Data.SqlClient.SqlCommand[] _commandCollection;
            
            private bool _clearBeforeFill;
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            public WTestTableAdapter() {
                this.ClearBeforeFill = true;
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            protected internal global::System.Data.SqlClient.SqlDataAdapter Adapter {
                get {
                    if ((this._adapter == null)) {
                        this.InitAdapter();
                    }
                    return this._adapter;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            internal global::System.Data.SqlClient.SqlConnection Connection {
                get {
                    if ((this._connection == null)) {
                        this.InitConnection();
                    }
                    return this._connection;
                }
                set {
                    this._connection = value;
                    if ((this.Adapter.InsertCommand != null)) {
                        this.Adapter.InsertCommand.Connection = value;
                    }
                    if ((this.Adapter.DeleteCommand != null)) {
                        this.Adapter.DeleteCommand.Connection = value;
                    }
                    if ((this.Adapter.UpdateCommand != null)) {
                        this.Adapter.UpdateCommand.Connection = value;
                    }
                    for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
                        if ((this.CommandCollection[i] != null)) {
                            ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[i])).Connection = value;
                        }
                    }
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            internal global::System.Data.SqlClient.SqlTransaction Transaction {
                get {
                    return this._transaction;
                }
                set {
                    this._transaction = value;
                    for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
                        this.CommandCollection[i].Transaction = this._transaction;
                    }
                    if (((this.Adapter != null) 
                                && (this.Adapter.DeleteCommand != null))) {
                        this.Adapter.DeleteCommand.Transaction = this._transaction;
                    }
                    if (((this.Adapter != null) 
                                && (this.Adapter.InsertCommand != null))) {
                        this.Adapter.InsertCommand.Transaction = this._transaction;
                    }
                    if (((this.Adapter != null) 
                                && (this.Adapter.UpdateCommand != null))) {
                        this.Adapter.UpdateCommand.Transaction = this._transaction;
                    }
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            protected global::System.Data.SqlClient.SqlCommand[] CommandCollection {
                get {
                    if ((this._commandCollection == null)) {
                        this.InitCommandCollection();
                    }
                    return this._commandCollection;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            public bool ClearBeforeFill {
                get {
                    return this._clearBeforeFill;
                }
                set {
                    this._clearBeforeFill = value;
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            private void InitAdapter() {
                this._adapter = new global::System.Data.SqlClient.SqlDataAdapter();
                global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping();
                tableMapping.SourceTable = "Table";
                tableMapping.DataSetTable = "WTest";
                tableMapping.ColumnMappings.Add("ID", "ID");
                tableMapping.ColumnMappings.Add("W", "W");
                tableMapping.ColumnMappings.Add("L", "L");
                tableMapping.ColumnMappings.Add("M", "M");
                tableMapping.ColumnMappings.Add("S", "S");
                tableMapping.ColumnMappings.Add("A", "A");
                tableMapping.ColumnMappings.Add("F", "F");
                tableMapping.ColumnMappings.Add("S", "S");
                this._adapter.TableMappings.Add(tableMapping);
                this._adapter.DeleteCommand = new global::System.Data.SqlClient.SqlCommand();
                this._adapter.DeleteCommand.Connection = this.Connection;
                this._adapter.DeleteCommand.CommandText = @"DELETE FROM [dbo].[WTest] WHERE (([ID] = @Original_ID) AND ((@IsNull_W = 1 AND [W] IS NULL) OR ([W] = @Original_W)) AND ((@IsNull_L = 1 AND [L] IS NULL) OR ([L] = @Original_L)) AND ((@IsNull_M = 1 AND [M] IS NULL) OR ([M] = @Original_M)) AND ((@IsNull_S = 1 AND [S] IS NULL) OR ([S] = @Original_S)) AND ((@IsNull_A = 1 AND [A] IS NULL) OR ([A] = @Original_A)) AND ((@IsNull_F = 1 AND [F] IS NULL) OR ([F] = @Original_F)) AND ((@IsNull_S = 1 AND [S] IS NULL) OR ([S] = @Original_S)))";
                this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text;
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_ID", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ID", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_W", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "W", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_W", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "W", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_L", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "L", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_L", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "L", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_M", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "M", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_M", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "M", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_S", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "S", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_S", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "S", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_A", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "A", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_A", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "A", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_F", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "F", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_F", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "F", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_S", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "S", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_S", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "S", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.InsertCommand = new global::System.Data.SqlClient.SqlCommand();
                this._adapter.InsertCommand.Connection = this.Connection;
                this._adapter.InsertCommand.CommandText = @"INSERT INTO [dbo].[WTest] ([ID], [W], [L], [M], [S], [A], [F], [S]) VALUES (@ID, @W, @L, @M, @S, @A, @F, @S);
    SELECT ID, W, L, M, S, A, F, S FROM WTest WHERE (ID = @ID)";
                this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text;
                this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@ID", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ID", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@W", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "W", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@L", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "L", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@M", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "M", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@S", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "S", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@A", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "A", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@F", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "F", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@S", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "S", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.UpdateCommand = new global::System.Data.SqlClient.SqlCommand();
                this._adapter.UpdateCommand.Connection = this.Connection;
                this._adapter.UpdateCommand.CommandText = @"UPDATE [dbo].[WTest] SET [ID] = @ID, [W] = @W, [L] = @L, [M] = @M, [S] = @S, [A] = @A, [F] = @F, [S] = @S WHERE (([ID] = @Original_ID) AND ((@IsNull_W = 1 AND [W] IS NULL) OR ([W] = @Original_W)) AND ((@IsNull_L = 1 AND [L] IS NULL) OR ([L] = @Original_L)) AND ((@IsNull_M = 1 AND [M] IS NULL) OR ([M] = @Original_M)) AND ((@IsNull_S = 1 AND [S] IS NULL) OR ([S] = @Original_S)) AND ((@IsNull_A = 1 AND [A] IS NULL) OR ([A] = @Original_A)) AND ((@IsNull_F = 1 AND [F] IS NULL) OR ([F] = @Original_F)) AND ((@IsNull_S = 1 AND [S] IS NULL) OR ([S] = @Original_S)));
    SELECT ID, W, L, M, S, A, F, S FROM WTest WHERE (ID = @ID)";
                this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text;
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@ID", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ID", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@W", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "W", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@L", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "L", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@M", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "M", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@S", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "S", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@A", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "A", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@F", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "F", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@S", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "S", global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_ID", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ID", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_W", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "W", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_W", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "W", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_L", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "L", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_L", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "L", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_M", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "M", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_M", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "M", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_S", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "S", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_S", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "S", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_A", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "A", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_A", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "A", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_F", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "F", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_F", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "F", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_S", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "S", global::System.Data.DataRowVersion.Original, true, null, "", "", ""));
                this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_S", global::System.Data.SqlDbType.UniqueIdentifier, 0, global::System.Data.ParameterDirection.Input, 0, 0, "S", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            private void InitConnection() {
                this._connection = new global::System.Data.SqlClient.SqlConnection();
                this._connection.ConnectionString = global::pubg_dbMaintUI.Properties.Settings.Default.PUBG_DEVConnectionString;
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            private void InitCommandCollection() {
                this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1];
                this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
                this._commandCollection[0].Connection = this.Connection;
                this._commandCollection[0].CommandText = "SELECT ID, W, L, M, S, A, F, S FROM dbo.WTe" +
                    "st";
                this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
            [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)]
            public virtual int Fill(PDataSet.WeaponSprayTestDataTable dataTable) {
                this.Adapter.SelectCommand = this.CommandCollection[0];
                if ((this.ClearBeforeFill == true)) {
                    dataTable.Clear();
                }
                int returnValue = this.Adapter.Fill(dataTable);
                return returnValue;
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
            [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)]
            public virtual PDataSet.WTestDataTable GetData() {
                this.Adapter.SelectCommand = this.CommandCollection[0];
                PDataSet.WTestDataTable dataTable = new PDataSet.WTestDataTable();
                this.Adapter.Fill(dataTable);
                return dataTable;
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
            public virtual int Update(PDataSet.WTestDataTable dataTable) {
                return this.Adapter.Update(dataTable);
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
            public virtual int Update(PDataSet dataSet) {
                return this.Adapter.Update(dataSet, "WTest");
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
            public virtual int Update(global::System.Data.DataRow dataRow) {
                return this.Adapter.Update(new global::System.Data.DataRow[] {
                            dataRow});
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
            public virtual int Update(global::System.Data.DataRow[] dataRows) {
                return this.Adapter.Update(dataRows);
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
            [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)]
            public virtual int Delete(System.Guid Original_ID, global::System.Nullable<global::System.Guid> Original_W, global::System.Nullable<global::System.Guid> Original_L, global::System.Nullable<global::System.Guid> Original_M, global::System.Nullable<global::System.Guid> Original_S, global::System.Nullable<global::System.Guid> Original_A, global::System.Nullable<global::System.Guid> Original_F, global::System.Nullable<global::System.Guid> Original_S) {
                this.Adapter.DeleteCommand.Parameters[0].Value = ((System.Guid)(Original_ID));
                if ((Original_W.HasValue == true)) {
                    this.Adapter.DeleteCommand.Parameters[1].Value = ((object)(0));
                    this.Adapter.DeleteCommand.Parameters[2].Value = ((System.Guid)(Original_W.Value));
                }
                else {
                    this.Adapter.DeleteCommand.Parameters[1].Value = ((object)(1));
                    this.Adapter.DeleteCommand.Parameters[2].Value = global::System.DBNull.Value;
                }
                if ((Original_L.HasValue == true)) {
                    this.Adapter.DeleteCommand.Parameters[3].Value = ((object)(0));
                    this.Adapter.DeleteCommand.Parameters[4].Value = ((System.Guid)(Original_L.Value));
                }
                else {
                    this.Adapter.DeleteCommand.Parameters[3].Value = ((object)(1));
                    this.Adapter.DeleteCommand.Parameters[4].Value = global::System.DBNull.Value;
                }
                if ((Original_Me.HasValue == true)) {
                    this.Adapter.DeleteCommand.Parameters[5].Value = ((object)(0));
                    this.Adapter.DeleteCommand.Parameters[6].Value = ((System.Guid)(Original_M.Value));
                }
                else {
                    this.Adapter.DeleteCommand.Parameters[5].Value = ((object)(1));
                    this.Adapter.DeleteCommand.Parameters[6].Value = global::System.DBNull.Value;
                }
                if ((Original_S.HasValue == true)) {
                    this.Adapter.DeleteCommand.Parameters[7].Value = ((object)(0));
                    this.Adapter.DeleteCommand.Parameters[8].Value = ((System.Guid)(Original_S.Value));
                }
                else {
                    this.Adapter.DeleteCommand.Parameters[7].Value = ((object)(1));
                    this.Adapter.DeleteCommand.Parameters[8].Value = global::System.DBNull.Value;
                }
                if ((Original_A.HasValue == true)) {
                    this.Adapter.DeleteCommand.Parameters[9].Value = ((object)(0));
                    this.Adapter.DeleteCommand.Parameters[10].Value = ((System.Guid)(Original_A.Value));
                }
                else {
                    this.Adapter.DeleteCommand.Parameters[9].Value = ((object)(1));
                    this.Adapter.DeleteCommand.Parameters[10].Value = global::System.DBNull.Value;
                }
                if ((Original_F.HasValue == true)) {
                    this.Adapter.DeleteCommand.Parameters[11].Value = ((object)(0));
                    this.Adapter.DeleteCommand.Parameters[12].Value = ((System.Guid)(Original_F.Value));
                }
                else {
                    this.Adapter.DeleteCommand.Parameters[11].Value = ((object)(1));
                    this.Adapter.DeleteCommand.Parameters[12].Value = global::System.DBNull.Value;
                }
                if ((Original_S.HasValue == true)) {
                    this.Adapter.DeleteCommand.Parameters[13].Value = ((object)(0));
                    this.Adapter.DeleteCommand.Parameters[14].Value = ((System.Guid)(Original_S.Value));
                }
                else {
                    this.Adapter.DeleteCommand.Parameters[13].Value = ((object)(1));
                    this.Adapter.DeleteCommand.Parameters[14].Value = global::System.DBNull.Value;
                }
                global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
                if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open) 
                            != global::System.Data.ConnectionState.Open)) {
                    this.Adapter.DeleteCommand.Connection.Open();
                }
                try {
                    int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery();
                    return returnValue;
                }
                finally {
                    if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
                        this.Adapter.DeleteCommand.Connection.Close();
                    }
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
            [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]
            public virtual int Insert(System.Guid ID, global::System.Nullable<global::System.Guid> W, global::System.Nullable<global::System.Guid> L, global::System.Nullable<global::System.Guid> M, global::System.Nullable<global::System.Guid> S, global::System.Nullable<global::System.Guid> A, global::System.Nullable<global::System.Guid> F, global::System.Nullable<global::System.Guid> S) {
                this.Adapter.InsertCommand.Parameters[0].Value = ((System.Guid)(ID));
                if ((W.HasValue == true)) {
                    this.Adapter.InsertCommand.Parameters[1].Value = ((System.Guid)(W.Value));
                }
                else {
                    this.Adapter.InsertCommand.Parameters[1].Value = global::System.DBNull.Value;
                }
                if ((L.HasValue == true)) {
                    this.Adapter.InsertCommand.Parameters[2].Value = ((System.Guid)(L.Value));
                }
                else {
                    this.Adapter.InsertCommand.Parameters[2].Value = global::System.DBNull.Value;
                }
                if ((M.HasValue == true)) {
                    this.Adapter.InsertCommand.Parameters[3].Value = ((System.Guid)(M.Value));
                }
                else {
                    this.Adapter.InsertCommand.Parameters[3].Value = global::System.DBNull.Value;
                }
                if ((S.HasValue == true)) {
                    this.Adapter.InsertCommand.Parameters[4].Value = ((System.Guid)(S.Value));
                }
                else {
                    this.Adapter.InsertCommand.Parameters[4].Value = global::System.DBNull.Value;
                }
                if ((A.HasValue == true)) {
                    this.Adapter.InsertCommand.Parameters[5].Value = ((System.Guid)(A.Value));
                }
                else {
                    this.Adapter.InsertCommand.Parameters[5].Value = global::System.DBNull.Value;
                }
                if ((F.HasValue == true)) {
                    this.Adapter.InsertCommand.Parameters[6].Value = ((System.Guid)(F.Value));
                }
                else {
                    this.Adapter.InsertCommand.Parameters[6].Value = global::System.DBNull.Value;
                }
                if ((S.HasValue == true)) {
                    this.Adapter.InsertCommand.Parameters[7].Value = ((System.Guid)(S.Value));
                }
                else {
                    this.Adapter.InsertCommand.Parameters[7].Value = global::System.DBNull.Value;
                }
                global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
                if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open) 
                            != global::System.Data.ConnectionState.Open)) {
                    this.Adapter.InsertCommand.Connection.Open();
                }
                try {
                    int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
                    return returnValue;
                }
                finally {
                    if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
                        this.Adapter.InsertCommand.Connection.Close();
                    }
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
            [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
            public virtual int Update(
                        System.Guid ID, 
                        global::System.Nullable<global::System.Guid> W, 
                        global::System.Nullable<global::System.Guid> L, 
                        global::System.Nullable<global::System.Guid> M, 
                        global::System.Nullable<global::System.Guid> S, 
                        global::System.Nullable<global::System.Guid> A, 
                        global::System.Nullable<global::System.Guid> F, 
                        global::System.Nullable<global::System.Guid> S, 
                        System.Guid Original_ID, 
                        global::System.Nullable<global::System.Guid> Original_W, 
                        global::System.Nullable<global::System.Guid> Original_L, 
                        global::System.Nullable<global::System.Guid> Original_M, 
                        global::System.Nullable<global::System.Guid> Original_S, 
                        global::System.Nullable<global::System.Guid> Original_A, 
                        global::System.Nullable<global::System.Guid> Original_F, 
                        global::System.Nullable<global::System.Guid> Original_S) {
                this.Adapter.UpdateCommand.Parameters[0].Value = ((System.Guid)(ID));
                if ((W.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[1].Value = ((System.Guid)(W.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[1].Value = global::System.DBNull.Value;
                }
                if ((L.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[2].Value = ((System.Guid)(L.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[2].Value = global::System.DBNull.Value;
                }
                if ((M.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[3].Value = ((System.Guid)(M.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[3].Value = global::System.DBNull.Value;
                }
                if ((S.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[4].Value = ((System.Guid)(S.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[4].Value = global::System.DBNull.Value;
                }
                if ((A.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[5].Value = ((System.Guid)(A.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[5].Value = global::System.DBNull.Value;
                }
                if ((F.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[6].Value = ((System.Guid)(F.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[6].Value = global::System.DBNull.Value;
                }
                if ((S.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[7].Value = ((System.Guid)(S.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[7].Value = global::System.DBNull.Value;
                }
                this.Adapter.UpdateCommand.Parameters[8].Value = ((System.Guid)(Original_ID));
                if ((Original_W.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[9].Value = ((object)(0));
                    this.Adapter.UpdateCommand.Parameters[10].Value = ((System.Guid)(Original_W.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[9].Value = ((object)(1));
                    this.Adapter.UpdateCommand.Parameters[10].Value = global::System.DBNull.Value;
                }
                if ((Original_L.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[11].Value = ((object)(0));
                    this.Adapter.UpdateCommand.Parameters[12].Value = ((System.Guid)(Original_L.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[11].Value = ((object)(1));
                    this.Adapter.UpdateCommand.Parameters[12].Value = global::System.DBNull.Value;
                }
                if ((Original_M.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[13].Value = ((object)(0));
                    this.Adapter.UpdateCommand.Parameters[14].Value = ((System.Guid)(Original_M.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[13].Value = ((object)(1));
                    this.Adapter.UpdateCommand.Parameters[14].Value = global::System.DBNull.Value;
                }
                if ((Original_S.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[15].Value = ((object)(0));
                    this.Adapter.UpdateCommand.Parameters[16].Value = ((System.Guid)(Original_S.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[15].Value = ((object)(1));
                    this.Adapter.UpdateCommand.Parameters[16].Value = global::System.DBNull.Value;
                }
                if ((Original_A.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[17].Value = ((object)(0));
                    this.Adapter.UpdateCommand.Parameters[18].Value = ((System.Guid)(Original_A.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[17].Value = ((object)(1));
                    this.Adapter.UpdateCommand.Parameters[18].Value = global::System.DBNull.Value;
                }
                if ((Original_F.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[19].Value = ((object)(0));
                    this.Adapter.UpdateCommand.Parameters[20].Value = ((System.Guid)(Original_F.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[19].Value = ((object)(1));
                    this.Adapter.UpdateCommand.Parameters[20].Value = global::System.DBNull.Value;
                }
                if ((Original_S.HasValue == true)) {
                    this.Adapter.UpdateCommand.Parameters[21].Value = ((object)(0));
                    this.Adapter.UpdateCommand.Parameters[22].Value = ((System.Guid)(Original_S.Value));
                }
                else {
                    this.Adapter.UpdateCommand.Parameters[21].Value = ((object)(1));
                    this.Adapter.UpdateCommand.Parameters[22].Value = global::System.DBNull.Value;
                }
                global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
                if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open) 
                            != global::System.Data.ConnectionState.Open)) {
                    this.Adapter.UpdateCommand.Connection.Open();
                }
                try {
                    int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery();
                    return returnValue;
                }
                finally {
                    if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
                        this.Adapter.UpdateCommand.Connection.Close();
                    }
                }
            }
            
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
            [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
            [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)]
            public virtual int Update(global::System.Nullable<global::System.Guid> W, global::System.Nullable<global::System.Guid> L, global::System.Nullable<global::System.Guid> M, global::System.Nullable<global::System.Guid> S, global::System.Nullable<global::System.Guid> A, global::System.Nullable<global::System.Guid> F, global::System.Nullable<global::System.Guid> S, System.Guid Original_ID, global::System.Nullable<global::System.Guid> Original_W, global::System.Nullable<global::System.Guid> Original_L, global::System.Nullable<global::System.Guid> Original_M, global::System.Nullable<global::System.Guid> Original_S, global::System.Nullable<global::System.Guid> Original_A, global::System.Nullable<global::System.Guid> Original_F, global::System.Nullable<global::System.Guid> Original_S) {
                return this.Update(Original_ID, W, L, M, S, A, F, S, Original_ID, Original_W, Original_L, Original_M, Original_S, Original_A, Original_F, Original_S);
            }
        }


    maybe also the connection string would help? 

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <configSections>
        </configSections>
        <connectionStrings>
            <add name="pMaintUI.Properties.Settings.PConnectionString"
                connectionString="Data Source=[REDACTED].database.windows.net;Initial Catalog=[REDACTED];Persist Security Info=True;User ID=[REDACTED];Password=[REDACTED]"
                providerName="System.Data.SqlClient" />
        </connectionStrings>
        <startup> 
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
        </startup>
    </configuration>

    Kamis, 29 November 2018 02.22

Semua Balasan

  • Hello,

    Try using GetChanges.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Jumat, 30 November 2018 02.04
  • Hi SteveSettle,

    This forum is discussing and asking questions about the Windows Form and ClickOnce, it will be more appropriate to ask your question at Azure Community Support.

    Thank you for your understanding.

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Senin, 03 Desember 2018 02.44