public void LoadUsers() { // Create a new dataset to hold the records returned from the call to FillDataSet. // A temporary dataset is used because filling the existing dataset would // require the databindings to be rebound. NBADWDataEntryApplication.dsUser objDataSetTemp1; objDataSetTemp1 = new NBADWDataEntryApplication.dsUser(); try { // Attempt to fill the temporary dataset. this.FillUsers(objDataSetTemp1); } catch (System.Exception eFillDataSet) { // Add your error handling code here. throw eFillDataSet; } try { // Empty the old records from the dataset. objdsUser.Clear(); // Merge the records into the main dataset. objdsUser.Merge(objDataSetTemp1); } catch (System.Exception eLoadMerge) { // Add your error handling code here. throw eLoadMerge; } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.oleDbdaUser = new System.Data.OleDb.OleDbDataAdapter(); this.oleDbDeleteCommand1 = new System.Data.OleDb.OleDbCommand(); this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection(); this.oleDbInsertCommand1 = new System.Data.OleDb.OleDbCommand(); this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand(); this.oleDbUpdateCommand1 = new System.Data.OleDb.OleDbCommand(); this.objdsUser = new NBADWDataEntryApplication.dsUser(); this.dvUser = new System.Data.DataView(); ((System.ComponentModel.ISupportInitialize)(this.objdsUser)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dvUser)).BeginInit(); // // oleDbdaUser // this.oleDbdaUser.DeleteCommand = this.oleDbDeleteCommand1; this.oleDbdaUser.InsertCommand = this.oleDbInsertCommand1; this.oleDbdaUser.SelectCommand = this.oleDbSelectCommand1; this.oleDbdaUser.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "User", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("Administrator", "Administrator"), new System.Data.Common.DataColumnMapping("FirstName", "FirstName"), new System.Data.Common.DataColumnMapping("LastLogin", "LastLogin"), new System.Data.Common.DataColumnMapping("LastName", "LastName"), new System.Data.Common.DataColumnMapping("Password", "Password"), new System.Data.Common.DataColumnMapping("UserDatabase", "UserDatabase"), new System.Data.Common.DataColumnMapping("UserID", "UserID"), new System.Data.Common.DataColumnMapping("UserName", "UserName"), new System.Data.Common.DataColumnMapping("UserAgency", "UserAgency"), new System.Data.Common.DataColumnMapping("Organization", "Organization")})}); this.oleDbdaUser.UpdateCommand = this.oleDbUpdateCommand1; // // oleDbDeleteCommand1 // this.oleDbDeleteCommand1.CommandText = @"DELETE FROM [User] WHERE (UserID = ?) AND (Administrator = ?) AND (FirstName = ? OR ? IS NULL AND FirstName IS NULL) AND (LastLogin = ? OR ? IS NULL AND LastLogin IS NULL) AND (LastName = ? OR ? IS NULL AND LastName IS NULL) AND (Organization = ? OR ? IS NULL AND Organization IS NULL) AND ([Password] = ? OR ? IS NULL AND [Password] IS NULL) AND (UserAgency = ? OR ? IS NULL AND UserAgency IS NULL) AND (UserDatabase = ? OR ? IS NULL AND UserDatabase IS NULL) AND (UserName = ? OR ? IS NULL AND UserName IS NULL)"; this.oleDbDeleteCommand1.Connection = this.oleDbConnection1; this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserID", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserID", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Administrator", System.Data.OleDb.OleDbType.Boolean, 2, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Administrator", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_FirstName", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "FirstName", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_FirstName1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "FirstName", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_LastLogin", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "LastLogin", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_LastLogin1", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "LastLogin", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_LastName", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "LastName", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_LastName1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "LastName", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Organization", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Organization", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Organization1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Organization", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Password", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Password", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Password1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Password", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserAgency", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserAgency", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserAgency1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserAgency", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserDatabase", System.Data.OleDb.OleDbType.VarWChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserDatabase", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserDatabase1", System.Data.OleDb.OleDbType.VarWChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserDatabase", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserName", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserName", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserName1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserName", System.Data.DataRowVersion.Original, null)); // // oleDbConnection1 // this.oleDbConnection1.ConnectionString = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Data Source=""C:\Data_Warehouse\Tabular_Data\Users.mdb"";Jet OLEDB:Engine Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:Global Bulk Transactions=1"; // // oleDbInsertCommand1 // this.oleDbInsertCommand1.CommandText = "INSERT INTO [User] (Administrator, FirstName, LastLogin, LastName, [Password], Us" + "erDatabase, UserName, UserAgency, Organization) VALUES (?, ?, ?, ?, ?, ?, ?, ?, " + "?)"; this.oleDbInsertCommand1.Connection = this.oleDbConnection1; this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Administrator", System.Data.OleDb.OleDbType.Boolean, 2, "Administrator")); this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("FirstName", System.Data.OleDb.OleDbType.VarWChar, 50, "FirstName")); this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("LastLogin", System.Data.OleDb.OleDbType.DBDate, 0, "LastLogin")); this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("LastName", System.Data.OleDb.OleDbType.VarWChar, 50, "LastName")); this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Password", System.Data.OleDb.OleDbType.VarWChar, 50, "Password")); this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("UserDatabase", System.Data.OleDb.OleDbType.VarWChar, 100, "UserDatabase")); this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("UserName", System.Data.OleDb.OleDbType.VarWChar, 50, "UserName")); this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("UserAgency", System.Data.OleDb.OleDbType.VarWChar, 50, "UserAgency")); this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Organization", System.Data.OleDb.OleDbType.VarWChar, 50, "Organization")); // // oleDbSelectCommand1 // this.oleDbSelectCommand1.CommandText = "SELECT Administrator, FirstName, LastLogin, LastName, [Password], UserDatabase, U" + "serID, UserName, UserAgency, Organization FROM [User]"; this.oleDbSelectCommand1.Connection = this.oleDbConnection1; // // oleDbUpdateCommand1 // this.oleDbUpdateCommand1.CommandText = @"UPDATE [User] SET Administrator = ?, FirstName = ?, LastLogin = ?, LastName = ?, [Password] = ?, UserDatabase = ?, UserName = ?, UserAgency = ?, Organization = ? WHERE (UserID = ?) AND (Administrator = ?) AND (FirstName = ? OR ? IS NULL AND FirstName IS NULL) AND (LastLogin = ? OR ? IS NULL AND LastLogin IS NULL) AND (LastName = ? OR ? IS NULL AND LastName IS NULL) AND (Organization = ? OR ? IS NULL AND Organization IS NULL) AND ([Password] = ? OR ? IS NULL AND [Password] IS NULL) AND (UserAgency = ? OR ? IS NULL AND UserAgency IS NULL) AND (UserDatabase = ? OR ? IS NULL AND UserDatabase IS NULL) AND (UserName = ? OR ? IS NULL AND UserName IS NULL)"; this.oleDbUpdateCommand1.Connection = this.oleDbConnection1; this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Administrator", System.Data.OleDb.OleDbType.Boolean, 2, "Administrator")); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("FirstName", System.Data.OleDb.OleDbType.VarWChar, 50, "FirstName")); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("LastLogin", System.Data.OleDb.OleDbType.DBDate, 0, "LastLogin")); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("LastName", System.Data.OleDb.OleDbType.VarWChar, 50, "LastName")); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Password", System.Data.OleDb.OleDbType.VarWChar, 50, "Password")); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("UserDatabase", System.Data.OleDb.OleDbType.VarWChar, 100, "UserDatabase")); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("UserName", System.Data.OleDb.OleDbType.VarWChar, 50, "UserName")); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("UserAgency", System.Data.OleDb.OleDbType.VarWChar, 50, "UserAgency")); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Organization", System.Data.OleDb.OleDbType.VarWChar, 50, "Organization")); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserID", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserID", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Administrator", System.Data.OleDb.OleDbType.Boolean, 2, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Administrator", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_FirstName", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "FirstName", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_FirstName1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "FirstName", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_LastLogin", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "LastLogin", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_LastLogin1", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "LastLogin", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_LastName", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "LastName", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_LastName1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "LastName", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Organization", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Organization", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Organization1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Organization", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Password", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Password", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Password1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Password", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserAgency", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserAgency", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserAgency1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserAgency", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserDatabase", System.Data.OleDb.OleDbType.VarWChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserDatabase", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserDatabase1", System.Data.OleDb.OleDbType.VarWChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserDatabase", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserName", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserName", System.Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_UserName1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserName", System.Data.DataRowVersion.Original, null)); // // objdsUser // this.objdsUser.DataSetName = "dsUser"; this.objdsUser.Locale = new System.Globalization.CultureInfo("en-US"); // // dvUser // this.dvUser.Sort = "UserName"; this.dvUser.Table = this.objdsUser.User; ((System.ComponentModel.ISupportInitialize)(this.objdsUser)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dvUser)).EndInit(); }