/// <summary> /// Releases this System.Windows.Forms.DataGrid. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { if (this.sqlDataAdapter != null) { this.sqlDataAdapter = null; } this.FK_Oit_GuidOrderID = System.Data.SqlTypes.SqlGuid.Null; this.FK_Oit_GuidProductID = System.Data.SqlTypes.SqlGuid.Null; } base.Dispose(disposing); }
/// <summary> /// Load or reloads a subset of the table content. In order to successfully /// call this method, you need to call first the Initialize method. /// </summary> /// <param name="startRecord">The zero-based record number to start with.</param> /// <param name="maxRecords">The maximum number of records to retrieve.</param> public void RefreshData(int startRecord, int maxRecords) { if (this.LastKnownConnectionType == OlymarsDemo.DataClasses.ConnectionType.None) { throw new InvalidOperationException("You must call the 'Initialize' method before calling this method."); } switch (this.LastKnownConnectionType) { case OlymarsDemo.DataClasses.ConnectionType.ConnectionString: this.sqlDataAdapter = new OlymarsDemo.SqlDataAdapters.SqlDataAdapter_tblOrderItem(this.connectionString, this.FK_Oit_GuidOrderID, this.FK_Oit_GuidProductID, "tblOrderItem"); break; case OlymarsDemo.DataClasses.ConnectionType.SqlConnection: this.sqlDataAdapter = new OlymarsDemo.SqlDataAdapters.SqlDataAdapter_tblOrderItem(this.sqlConnection, this.FK_Oit_GuidOrderID, this.FK_Oit_GuidProductID, "tblOrderItem"); break; } this.dataSet = null; if (startRecord == -1 && maxRecords == -1) { this.sqlDataAdapter.FillDataSet(ref this.dataSet); } else { this.sqlDataAdapter.FillDataSet(ref this.dataSet, startRecord, maxRecords); } this.dataSet.Tables["tblOrderItem"].Columns["Oit_GuidID"].Caption = "Oit_GuidID (update this label in the \"Olymars/ColumnLabel\" extended property of the \"Oit_GuidID\" column)"; this.dataSet.Tables["tblOrderItem"].Columns["Oit_GuidOrderID"].Caption = "Oit_GuidOrderID (update this label in the \"Olymars/ColumnLabel\" extended property of the \"Oit_GuidOrderID\" column)"; this.dataSet.Tables["tblOrderItem"].Columns["Oit_GuidProductID"].Caption = "Oit_GuidProductID (update this label in the \"Olymars/ColumnLabel\" extended property of the \"Oit_GuidProductID\" column)"; this.dataSet.Tables["tblOrderItem"].Columns["Oit_LngAmount"].Caption = "Oit_LngAmount (update this label in the \"Olymars/ColumnLabel\" extended property of the \"Oit_LngAmount\" column)"; this.bindingInProgress = true; this.DataSource = this.dataSet.Tables["tblOrderItem"].DefaultView; this.bindingInProgress = false; }