urgent !!!! problem updating data set

  • Thread starter NicK chlam via DotNetMonster.com
  • Start date
N

NicK chlam via DotNetMonster.com

i haveing a problem updating my data set i get an error saying
An unhandled exception of type 'System.ArgumentNullException'
occurred in system.data.dll

Additional information: Value cannot be null.

//***********************************************************
//Student Name: Nicholas Chlam Email Address: (e-mail address removed)
//Assignment #: 1
//Instructor: leung
//Date Assigned: / / Date Due: 03 / 31 / 05 Date Finished 03 /31 /05
//***********************************************************
//Program Description: This is a simple program that creates an id
// from user input into text boxes
//
//***********************************************************
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace ChlamnE1
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.TextBox deptTextBox;
private System.Windows.Forms.TextBox idTextBox;
private System.Windows.Forms.TextBox ageTextBox;
private System.Windows.Forms.Label deptLabel;
private System.Windows.Forms.Label idLabel;
private System.Windows.Forms.Label ageLabel;
private System.Windows.Forms.PictureBox kidPicture;
private System.Windows.Forms.PictureBox teenPicture;
private System.Windows.Forms.PictureBox adultPicture;
private System.Windows.Forms.Button createButton;
private System.Windows.Forms.Button clearButton;
private System.Windows.Forms.Button exitButton;
private System.Windows.Forms.Label idAgeLabel;
private System.Windows.Forms.Label idIDLabel;
private System.Windows.Forms.Label idDeptLabel;
private System.Windows.Forms.Label idNameLabel;
private System.Windows.Forms.Label inIDLabel;
private System.Windows.Forms.Label inDeptLabel;
private System.Windows.Forms.Label inNameLabel;
private System.Windows.Forms.Label inAgeLabel;
private System.Windows.Forms.GroupBox IDgroupBox;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Data.OleDb.OleDbConnection oleDbConnection1;
private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
private System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
private System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
private System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;
private System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;
private ChlamnE1.DataSet1 dataSet11;
private System.Windows.Forms.Button LastButton;
private System.Windows.Forms.Button NextButton;
private System.Windows.Forms.Button PrevButton;
private System.Windows.Forms.Button FirstButton;
private System.Windows.Forms.Button saveButton;
private System.Windows.Forms.Button newButton;
private System.Windows.Forms.TextBox ID1TextBox;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (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()
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));
this.nameLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.dataSet11 = new ChlamnE1.DataSet1();
this.deptTextBox = new System.Windows.Forms.TextBox();
this.idTextBox = new System.Windows.Forms.TextBox();
this.ageTextBox = new System.Windows.Forms.TextBox();
this.deptLabel = new System.Windows.Forms.Label();
this.idLabel = new System.Windows.Forms.Label();
this.ageLabel = new System.Windows.Forms.Label();
this.kidPicture = new System.Windows.Forms.PictureBox();
this.teenPicture = new System.Windows.Forms.PictureBox();
this.adultPicture = new System.Windows.Forms.PictureBox();
this.createButton = new System.Windows.Forms.Button();
this.clearButton = new System.Windows.Forms.Button();
this.exitButton = new System.Windows.Forms.Button();
this.idAgeLabel = new System.Windows.Forms.Label();
this.idIDLabel = new System.Windows.Forms.Label();
this.idDeptLabel = new System.Windows.Forms.Label();
this.idNameLabel = new System.Windows.Forms.Label();
this.inAgeLabel = new System.Windows.Forms.Label();
this.inIDLabel = new System.Windows.Forms.Label();
this.inDeptLabel = new System.Windows.Forms.Label();
this.inNameLabel = new System.Windows.Forms.Label();
this.IDgroupBox = new System.Windows.Forms.GroupBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter();
this.oleDbDeleteCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbInsertCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbUpdateCommand1 = new System.Data.OleDb.OleDbCommand();
this.LastButton = new System.Windows.Forms.Button();
this.NextButton = new System.Windows.Forms.Button();
this.PrevButton = new System.Windows.Forms.Button();
this.FirstButton = new System.Windows.Forms.Button();
this.saveButton = new System.Windows.Forms.Button();
this.newButton = new System.Windows.Forms.Button();
this.ID1TextBox = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
this.IDgroupBox.SuspendLayout();
this.SuspendLayout();
//
// nameLabel
//
this.nameLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.nameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.nameLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.nameLabel.Location = new System.Drawing.Point(160, 8);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(96, 16);
this.nameLabel.TabIndex = 0;
this.nameLabel.Text = "Name";
this.nameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// nameTextBox
//
this.nameTextBox.DataBindings.Add(new System.Windows.Forms.Binding
("Text", this.dataSet11, "tblID.name"));
this.nameTextBox.Location = new System.Drawing.Point(264, 8);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.ReadOnly = true;
this.nameTextBox.Size = new System.Drawing.Size(112, 20);
this.nameTextBox.TabIndex = 1;
this.nameTextBox.Text = "";
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("en-US");
//
// deptTextBox
//
this.deptTextBox.DataBindings.Add(new System.Windows.Forms.Binding
("Text", this.dataSet11, "tblID.Dept"));
this.deptTextBox.Location = new System.Drawing.Point(264, 32);
this.deptTextBox.Name = "deptTextBox";
this.deptTextBox.ReadOnly = true;
this.deptTextBox.Size = new System.Drawing.Size(112, 20);
this.deptTextBox.TabIndex = 2;
this.deptTextBox.Text = "";
//
// idTextBox
//
this.idTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text",
this.dataSet11, "tblID.ID"));
this.idTextBox.Location = new System.Drawing.Point(264, 56);
this.idTextBox.Name = "idTextBox";
this.idTextBox.ReadOnly = true;
this.idTextBox.Size = new System.Drawing.Size(112, 20);
this.idTextBox.TabIndex = 3;
this.idTextBox.Text = "";
//
// ageTextBox
//
this.ageTextBox.DataBindings.Add(new System.Windows.Forms.Binding
("Text", this.dataSet11, "tblID.Age"));
this.ageTextBox.Location = new System.Drawing.Point(264, 80);
this.ageTextBox.Name = "ageTextBox";
this.ageTextBox.ReadOnly = true;
this.ageTextBox.Size = new System.Drawing.Size(112, 20);
this.ageTextBox.TabIndex = 4;
this.ageTextBox.Text = "";
//
// deptLabel
//
this.deptLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.deptLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.deptLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.deptLabel.Location = new System.Drawing.Point(160, 32);
this.deptLabel.Name = "deptLabel";
this.deptLabel.Size = new System.Drawing.Size(96, 16);
this.deptLabel.TabIndex = 5;
this.deptLabel.Text = "Dept";
this.deptLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// idLabel
//
this.idLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.idLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.idLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.idLabel.Location = new System.Drawing.Point(160, 56);
this.idLabel.Name = "idLabel";
this.idLabel.Size = new System.Drawing.Size(96, 16);
this.idLabel.TabIndex = 6;
this.idLabel.Text = "ID";
this.idLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// ageLabel
//
this.ageLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.ageLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.ageLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ageLabel.Location = new System.Drawing.Point(160, 80);
this.ageLabel.Name = "ageLabel";
this.ageLabel.Size = new System.Drawing.Size(96, 16);
this.ageLabel.TabIndex = 7;
this.ageLabel.Text = "Age";
this.ageLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// kidPicture
//
this.kidPicture.Image = ((System.Drawing.Image)(resources.GetObject
("kidPicture.Image")));
this.kidPicture.Location = new System.Drawing.Point(24, 32);
this.kidPicture.Name = "kidPicture";
this.kidPicture.Size = new System.Drawing.Size(112, 96);
this.kidPicture.TabIndex = 8;
this.kidPicture.TabStop = false;
this.kidPicture.Visible = false;
//
// teenPicture
//
this.teenPicture.Image = ((System.Drawing.Image)(resources.GetObject
("teenPicture.Image")));
this.teenPicture.Location = new System.Drawing.Point(24, 24);
this.teenPicture.Name = "teenPicture";
this.teenPicture.Size = new System.Drawing.Size(112, 120);
this.teenPicture.TabIndex = 9;
this.teenPicture.TabStop = false;
this.teenPicture.Visible = false;
//
// adultPicture
//
this.adultPicture.Image = ((System.Drawing.Image)(resources.GetObject
("adultPicture.Image")));
this.adultPicture.Location = new System.Drawing.Point(40, 32);
this.adultPicture.Name = "adultPicture";
this.adultPicture.Size = new System.Drawing.Size(80, 96);
this.adultPicture.TabIndex = 10;
this.adultPicture.TabStop = false;
this.adultPicture.Visible = false;
//
// createButton
//
this.createButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.createButton.Location = new System.Drawing.Point(280, 192);
this.createButton.Name = "createButton";
this.createButton.Size = new System.Drawing.Size(112, 24);
this.createButton.TabIndex = 11;
this.createButton.Text = "Create ID";
this.createButton.Click += new System.EventHandler
(this.createButton_Click);
//
// clearButton
//
this.clearButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.clearButton.Location = new System.Drawing.Point(184, 192);
this.clearButton.Name = "clearButton";
this.clearButton.Size = new System.Drawing.Size(88, 24);
this.clearButton.TabIndex = 12;
this.clearButton.Text = "Clear";
this.clearButton.Click += new System.EventHandler(this.clearButton_Click)
;
//
// exitButton
//
this.exitButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.exitButton.Location = new System.Drawing.Point(88, 192);
this.exitButton.Name = "exitButton";
this.exitButton.Size = new System.Drawing.Size(88, 24);
this.exitButton.TabIndex = 13;
this.exitButton.Text = "Exit";
this.exitButton.Click += new System.EventHandler(this.exitButton_Click);
//
// idAgeLabel
//
this.idAgeLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.idAgeLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.idAgeLabel.ForeColor =
System.Drawing.SystemColors.ActiveCaptionText;
this.idAgeLabel.Location = new System.Drawing.Point(168, 96);
this.idAgeLabel.Name = "idAgeLabel";
this.idAgeLabel.Size = new System.Drawing.Size(96, 16);
this.idAgeLabel.TabIndex = 21;
this.idAgeLabel.Text = "Age";
this.idAgeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// idIDLabel
//
this.idIDLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.idIDLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.idIDLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.idIDLabel.Location = new System.Drawing.Point(168, 72);
this.idIDLabel.Name = "idIDLabel";
this.idIDLabel.Size = new System.Drawing.Size(96, 16);
this.idIDLabel.TabIndex = 20;
this.idIDLabel.Text = "ID";
this.idIDLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// idDeptLabel
//
this.idDeptLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.idDeptLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.idDeptLabel.ForeColor =
System.Drawing.SystemColors.ActiveCaptionText;
this.idDeptLabel.Location = new System.Drawing.Point(168, 48);
this.idDeptLabel.Name = "idDeptLabel";
this.idDeptLabel.Size = new System.Drawing.Size(96, 16);
this.idDeptLabel.TabIndex = 19;
this.idDeptLabel.Text = "Dept";
this.idDeptLabel.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;
//
// idNameLabel
//
this.idNameLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.idNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.idNameLabel.ForeColor =
System.Drawing.SystemColors.ActiveCaptionText;
this.idNameLabel.Location = new System.Drawing.Point(168, 24);
this.idNameLabel.Name = "idNameLabel";
this.idNameLabel.Size = new System.Drawing.Size(96, 16);
this.idNameLabel.TabIndex = 14;
this.idNameLabel.Text = "Name";
this.idNameLabel.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;
//
// inAgeLabel
//
this.inAgeLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.inAgeLabel.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.inAgeLabel.Location = new System.Drawing.Point(280, 96);
this.inAgeLabel.Name = "inAgeLabel";
this.inAgeLabel.Size = new System.Drawing.Size(96, 16);
this.inAgeLabel.TabIndex = 25;
this.inAgeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// inIDLabel
//
this.inIDLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.inIDLabel.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.inIDLabel.Location = new System.Drawing.Point(280, 72);
this.inIDLabel.Name = "inIDLabel";
this.inIDLabel.Size = new System.Drawing.Size(96, 16);
this.inIDLabel.TabIndex = 24;
this.inIDLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// inDeptLabel
//
this.inDeptLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.inDeptLabel.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.inDeptLabel.Location = new System.Drawing.Point(280, 48);
this.inDeptLabel.Name = "inDeptLabel";
this.inDeptLabel.Size = new System.Drawing.Size(96, 16);
this.inDeptLabel.TabIndex = 23;
this.inDeptLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// inNameLabel
//
this.inNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.inNameLabel.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.inNameLabel.Location = new System.Drawing.Point(280, 24);
this.inNameLabel.Name = "inNameLabel";
this.inNameLabel.Size = new System.Drawing.Size(96, 16);
this.inNameLabel.TabIndex = 22;
this.inNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// IDgroupBox
//
this.IDgroupBox.Controls.Add(this.teenPicture);
this.IDgroupBox.Controls.Add(this.inAgeLabel);
this.IDgroupBox.Controls.Add(this.inIDLabel);
this.IDgroupBox.Controls.Add(this.inDeptLabel);
this.IDgroupBox.Controls.Add(this.adultPicture);
this.IDgroupBox.Controls.Add(this.idNameLabel);
this.IDgroupBox.Controls.Add(this.inNameLabel);
this.IDgroupBox.Controls.Add(this.idAgeLabel);
this.IDgroupBox.Controls.Add(this.idIDLabel);
this.IDgroupBox.Controls.Add(this.kidPicture);
this.IDgroupBox.Controls.Add(this.idDeptLabel);
this.IDgroupBox.Location = new System.Drawing.Point(8, 240);
this.IDgroupBox.Name = "IDgroupBox";
this.IDgroupBox.Size = new System.Drawing.Size(392, 152);
this.IDgroupBox.TabIndex = 26;
this.IDgroupBox.TabStop = false;
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject
("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(16, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(112, 120);
this.pictureBox1.TabIndex = 27;
this.pictureBox1.TabStop = false;
//
// oleDbConnection1
//
this.oleDbConnection1.ConnectionString = @"Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Data
Source=""C:\Temp\Nick\chlamnE1\ChlamnE1\EmployeeID.mdb"";Mode=Share Deny
None;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=;Jet OLEDB:Compact Without Replica
Repair=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System
Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;User
ID=Admin;Jet OLEDB:Global Bulk Transactions=1";
//
// oleDbDataAdapter1
//
this.oleDbDataAdapter1.DeleteCommand = this.oleDbDeleteCommand1;
this.oleDbDataAdapter1.InsertCommand = this.oleDbInsertCommand1;
this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1;
this.oleDbDataAdapter1.TableMappings.AddRange(new
System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table",
"tblID", new System.Data.Common.DataColumnMapping[] {
new
System.Data.Common.DataColumnMapping("ID1", "ID1"),
new
System.Data.Common.DataColumnMapping("name", "name"),
new
System.Data.Common.DataColumnMapping("ID", "ID"),
new
System.Data.Common.DataColumnMapping("Dept", "Dept"),
new
System.Data.Common.DataColumnMapping("Age", "Age")})});
this.oleDbDataAdapter1.UpdateCommand = this.oleDbUpdateCommand1;
//
// oleDbDeleteCommand1
//
this.oleDbDeleteCommand1.CommandText = "DELETE FROM tblID WHERE (ID1 = ?)
AND (Age = ? OR ? IS NULL AND Age IS NULL) AND " +
"(Dept = ? OR ? IS NULL AND Dept IS NULL) AND (ID = ? OR ? IS NULL AND
ID IS NULL" +
") AND (name = ? OR ? IS NULL AND name IS NULL)";
this.oleDbDeleteCommand1.Connection = this.oleDbConnection1;
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_ID1",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "ID1", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Age",
System.Data.OleDb.OleDbType.SmallInt, 0,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Age", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Age1",
System.Data.OleDb.OleDbType.SmallInt, 0,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Age", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Dept",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Dept", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Dept1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Dept", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_ID",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "ID", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_ID2",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "ID", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_name",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "name", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_name1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "name", System.Data.DataRowVersion.Original, null));
//
// oleDbInsertCommand1
//
this.oleDbInsertCommand1.CommandText = "INSERT INTO tblID(name, ID,
Dept, Age) VALUES (?, ?, ?, ?)";
this.oleDbInsertCommand1.Connection = this.oleDbConnection1;
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("name",
System.Data.OleDb.OleDbType.VarWChar, 50, "name"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("ID",
System.Data.OleDb.OleDbType.VarWChar, 50, "ID"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Dept",
System.Data.OleDb.OleDbType.VarWChar, 50, "Dept"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Age",
System.Data.OleDb.OleDbType.SmallInt, 0, "Age"));
//
// oleDbSelectCommand1
//
this.oleDbSelectCommand1.CommandText = "SELECT ID1, name, ID, Dept, Age
FROM tblID";
this.oleDbSelectCommand1.Connection = this.oleDbConnection1;
//
// oleDbUpdateCommand1
//
this.oleDbUpdateCommand1.CommandText = "UPDATE tblID SET name = ?, ID = ?
, Dept = ?, Age = ? WHERE (ID1 = ?) AND (Age = ?" +
" OR ? IS NULL AND Age IS NULL) AND (Dept = ? OR ? IS NULL AND Dept IS
NULL) AND " +
"(ID = ? OR ? IS NULL AND ID IS NULL) AND (name = ? OR ? IS NULL AND
name IS NULL" +
")";
this.oleDbUpdateCommand1.Connection = this.oleDbConnection1;
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("name",
System.Data.OleDb.OleDbType.VarWChar, 50, "name"));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("ID",
System.Data.OleDb.OleDbType.VarWChar, 50, "ID"));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Dept",
System.Data.OleDb.OleDbType.VarWChar, 50, "Dept"));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Age",
System.Data.OleDb.OleDbType.SmallInt, 0, "Age"));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_ID1",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "ID1", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Age",
System.Data.OleDb.OleDbType.SmallInt, 0,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Age", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Age1",
System.Data.OleDb.OleDbType.SmallInt, 0,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Age", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Dept",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Dept", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Dept1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Dept", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_ID",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "ID", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_ID2",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "ID", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_name",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "name", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_name1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "name", System.Data.DataRowVersion.Original, null));
//
// LastButton
//
this.LastButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.LastButton.Location = new System.Drawing.Point(328, 128);
this.LastButton.Name = "LastButton";
this.LastButton.Size = new System.Drawing.Size(40, 24);
this.LastButton.TabIndex = 28;
this.LastButton.Text = "| >";
this.LastButton.Click += new System.EventHandler(this.LastButton_Click);
//
// NextButton
//
this.NextButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.NextButton.Location = new System.Drawing.Point(280, 128);
this.NextButton.Name = "NextButton";
this.NextButton.Size = new System.Drawing.Size(40, 24);
this.NextButton.TabIndex = 29;
this.NextButton.Text = ">";
this.NextButton.Click += new System.EventHandler(this.NextButton_Click);
//
// PrevButton
//
this.PrevButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.PrevButton.Location = new System.Drawing.Point(232, 128);
this.PrevButton.Name = "PrevButton";
this.PrevButton.Size = new System.Drawing.Size(40, 24);
this.PrevButton.TabIndex = 30;
this.PrevButton.Text = "<";
this.PrevButton.Click += new System.EventHandler(this.PrevButton_Click);
//
// FirstButton
//
this.FirstButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.FirstButton.Location = new System.Drawing.Point(184, 128);
this.FirstButton.Name = "FirstButton";
this.FirstButton.Size = new System.Drawing.Size(40, 24);
this.FirstButton.TabIndex = 31;
this.FirstButton.Text = "< |";
this.FirstButton.Click += new System.EventHandler(this.FirstButton_Click)
;
//
// saveButton
//
this.saveButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.saveButton.Location = new System.Drawing.Point(280, 160);
this.saveButton.Name = "saveButton";
this.saveButton.Size = new System.Drawing.Size(80, 24);
this.saveButton.TabIndex = 32;
this.saveButton.Text = "Save";
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
//
// newButton
//
this.newButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.newButton.Location = new System.Drawing.Point(192, 160);
this.newButton.Name = "newButton";
this.newButton.Size = new System.Drawing.Size(80, 24);
this.newButton.TabIndex = 33;
this.newButton.Text = "New";
this.newButton.Click += new System.EventHandler(this.newButton_Click);
//
// ID1TextBox
//
this.ID1TextBox.DataBindings.Add(new System.Windows.Forms.Binding
("Text", this.dataSet11, "tblID.ID1"));
this.ID1TextBox.Location = new System.Drawing.Point(264, 104);
this.ID1TextBox.Name = "ID1TextBox";
this.ID1TextBox.ReadOnly = true;
this.ID1TextBox.Size = new System.Drawing.Size(56, 20);
this.ID1TextBox.TabIndex = 34;
this.ID1TextBox.Text = "";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ClientSize = new System.Drawing.Size(416, 237);
this.Controls.Add(this.ID1TextBox);
this.Controls.Add(this.newButton);
this.Controls.Add(this.saveButton);
this.Controls.Add(this.FirstButton);
this.Controls.Add(this.PrevButton);
this.Controls.Add(this.NextButton);
this.Controls.Add(this.LastButton);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.IDgroupBox);
this.Controls.Add(this.exitButton);
this.Controls.Add(this.clearButton);
this.Controls.Add(this.createButton);
this.Controls.Add(this.ageLabel);
this.Controls.Add(this.idLabel);
this.Controls.Add(this.deptLabel);
this.Controls.Add(this.ageTextBox);
this.Controls.Add(this.idTextBox);
this.Controls.Add(this.deptTextBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
this.IDgroupBox.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void Form1_Load(object sender, System.EventArgs e)
{
oleDbDataAdapter1.Fill(dataSet11,"tblID");
}


private void exitButton_Click(object sender, System.EventArgs e)
{
this.Close();
}

private void clearButton_Click(object sender, System.EventArgs e)
{
ClearID();
ClearInput();
this.Height = 208;
}

private void createButton_Click(object sender, System.EventArgs e)
{
CheckifBlank();
FillID();
CheckifFilled();
CheckAge();

}
private void ClearID()
{
inNameLabel.Text = "";
inDeptLabel.Text = "";
inIDLabel.Text = "";
inAgeLabel.Text = "";

adultPicture.Visible = false;
kidPicture.Visible = false;
teenPicture.Visible = false;
}
private void ClearInput()
{
nameTextBox.Clear();
deptTextBox.Clear();
idTextBox.Clear();
ageTextBox.Clear();
}
private void CheckifBlank()
{
if(nameTextBox.Text == "" && deptTextBox.Text == "" && idTextBox.Text ==
"" && ageTextBox.Text == "")
{
MessageBox.Show("Please Enter All Data");
nameTextBox.Focus();
}

else if (nameTextBox.Text == "")
{
MessageBox.Show("Input Name");
nameTextBox.Focus();
}
else if(deptTextBox.Text == "")
{
MessageBox.Show("Input Department");
deptTextBox.Focus();
}
else if (idTextBox.Text == "")
{
MessageBox.Show("Input ID");
idTextBox.Focus();
}
else if (ageTextBox.Text == "")
{
MessageBox.Show("Input Age");
idTextBox.Focus();
}

}
private void CheckAge()
{
int intAge = 0;
if (ageTextBox.Text != "")
{

try
{
intAge = int.Parse(ageTextBox.Text.Trim());
}
catch (FormatException myErr)
{
MessageBox.Show ("Error in input data:" + myErr.Message);
this.Height = 208;
ClearID();
ClearInput();
}


if(intAge < 18 )
{
kidPicture.Visible = true;
}
if(intAge >= 18 && intAge < 30)
{
teenPicture.Visible = true;
}
if(intAge >=30)
{
adultPicture.Visible = true;
}
}

}
private void FillID()
{
inNameLabel.Text = nameTextBox.Text;
inDeptLabel.Text = deptTextBox.Text;
inIDLabel.Text = idTextBox.Text;
inAgeLabel.Text = ageTextBox.Text;

}
private void CheckifFilled()
{
if(inNameLabel.Text != "" && inDeptLabel.Text != "" && inIDLabel.Text !=
"" && inAgeLabel.Text != "")
{

this.Height = 432;



}
}

// Database proceesing code

private void Bind()
{




}

private void LastButton_Click(object sender, System.EventArgs e)
{
this.BindingContext[dataSet11, "tblID"].Position = this.BindingContext
[dataSet11, "tblID"].Count - 1;
}

private void NextButton_Click(object sender, System.EventArgs e)
{
if(this.BindingContext[dataSet11,"tblID"].Position ==
this.BindingContext[dataSet11, "tblID"].Count - 1)
{
MessageBox.Show("end of file");
}
else
this.BindingContext[dataSet11,"tblID"].Position +=1;
}

private void PrevButton_Click(object sender, System.EventArgs e)
{
this.BindingContext[dataSet11,"tblID"].Position -=1;
}

private void FirstButton_Click(object sender, System.EventArgs e)
{
this.BindingContext[dataSet11,"tblID"].Position = 0;
}
private void save()
{
this.CheckifBlank();
DataSet insertrow = new DataSet();
DataSet modrow = new DataSet();
DataSet delrow= new DataSet();

insertrow = dataSet11.GetChanges(DataRowState.Added);
modrow = dataSet11.GetChanges(DataRowState.Modified);
delrow = dataSet11.GetChanges(DataRowState.Deleted);
try
{
oleDbDataAdapter1.Update(insertrow);
}
catch (FormatException myErr)
{
MessageBox.Show ("Error in input data:" + myErr.Message);
}

oleDbDataAdapter1.Update(modrow);
oleDbDataAdapter1.Update(delrow);

dataSet11.AcceptChanges();
}

private void saveButton_Click(object sender, System.EventArgs e)
{
save();
}

private void newButton_Click(object sender, System.EventArgs e)
{
nameTextBox.ReadOnly = false;
deptTextBox.ReadOnly = false;
idTextBox.ReadOnly = false;
ageTextBox.ReadOnly = false;
ID1TextBox.ReadOnly = false;
this.BindingContext[dataSet11,"tblID"].AddNew();
}

}
}
 
L

Landi

Where is your error happening? What line number?

--
(e-mail address removed)
http://dowhileloop.com website development
http://publicjoe.dowhileloop.com -- C# Tutorials
NicK chlam via DotNetMonster.com said:
i haveing a problem updating my data set i get an error saying
An unhandled exception of type 'System.ArgumentNullException'
occurred in system.data.dll

Additional information: Value cannot be null.

//***********************************************************
//Student Name: Nicholas Chlam Email Address: (e-mail address removed)
//Assignment #: 1
//Instructor: leung
//Date Assigned: / / Date Due: 03 / 31 / 05 Date Finished 03 /31 /05
//***********************************************************
//Program Description: This is a simple program that creates an id
// from user input into text boxes
//
//***********************************************************
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace ChlamnE1
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.TextBox deptTextBox;
private System.Windows.Forms.TextBox idTextBox;
private System.Windows.Forms.TextBox ageTextBox;
private System.Windows.Forms.Label deptLabel;
private System.Windows.Forms.Label idLabel;
private System.Windows.Forms.Label ageLabel;
private System.Windows.Forms.PictureBox kidPicture;
private System.Windows.Forms.PictureBox teenPicture;
private System.Windows.Forms.PictureBox adultPicture;
private System.Windows.Forms.Button createButton;
private System.Windows.Forms.Button clearButton;
private System.Windows.Forms.Button exitButton;
private System.Windows.Forms.Label idAgeLabel;
private System.Windows.Forms.Label idIDLabel;
private System.Windows.Forms.Label idDeptLabel;
private System.Windows.Forms.Label idNameLabel;
private System.Windows.Forms.Label inIDLabel;
private System.Windows.Forms.Label inDeptLabel;
private System.Windows.Forms.Label inNameLabel;
private System.Windows.Forms.Label inAgeLabel;
private System.Windows.Forms.GroupBox IDgroupBox;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Data.OleDb.OleDbConnection oleDbConnection1;
private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
private System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
private System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
private System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;
private System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;
private ChlamnE1.DataSet1 dataSet11;
private System.Windows.Forms.Button LastButton;
private System.Windows.Forms.Button NextButton;
private System.Windows.Forms.Button PrevButton;
private System.Windows.Forms.Button FirstButton;
private System.Windows.Forms.Button saveButton;
private System.Windows.Forms.Button newButton;
private System.Windows.Forms.TextBox ID1TextBox;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (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()
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));
this.nameLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.dataSet11 = new ChlamnE1.DataSet1();
this.deptTextBox = new System.Windows.Forms.TextBox();
this.idTextBox = new System.Windows.Forms.TextBox();
this.ageTextBox = new System.Windows.Forms.TextBox();
this.deptLabel = new System.Windows.Forms.Label();
this.idLabel = new System.Windows.Forms.Label();
this.ageLabel = new System.Windows.Forms.Label();
this.kidPicture = new System.Windows.Forms.PictureBox();
this.teenPicture = new System.Windows.Forms.PictureBox();
this.adultPicture = new System.Windows.Forms.PictureBox();
this.createButton = new System.Windows.Forms.Button();
this.clearButton = new System.Windows.Forms.Button();
this.exitButton = new System.Windows.Forms.Button();
this.idAgeLabel = new System.Windows.Forms.Label();
this.idIDLabel = new System.Windows.Forms.Label();
this.idDeptLabel = new System.Windows.Forms.Label();
this.idNameLabel = new System.Windows.Forms.Label();
this.inAgeLabel = new System.Windows.Forms.Label();
this.inIDLabel = new System.Windows.Forms.Label();
this.inDeptLabel = new System.Windows.Forms.Label();
this.inNameLabel = new System.Windows.Forms.Label();
this.IDgroupBox = new System.Windows.Forms.GroupBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter();
this.oleDbDeleteCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbInsertCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbUpdateCommand1 = new System.Data.OleDb.OleDbCommand();
this.LastButton = new System.Windows.Forms.Button();
this.NextButton = new System.Windows.Forms.Button();
this.PrevButton = new System.Windows.Forms.Button();
this.FirstButton = new System.Windows.Forms.Button();
this.saveButton = new System.Windows.Forms.Button();
this.newButton = new System.Windows.Forms.Button();
this.ID1TextBox = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
this.IDgroupBox.SuspendLayout();
this.SuspendLayout();
//
// nameLabel
//
this.nameLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.nameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.nameLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.nameLabel.Location = new System.Drawing.Point(160, 8);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(96, 16);
this.nameLabel.TabIndex = 0;
this.nameLabel.Text = "Name";
this.nameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// nameTextBox
//
this.nameTextBox.DataBindings.Add(new System.Windows.Forms.Binding
("Text", this.dataSet11, "tblID.name"));
this.nameTextBox.Location = new System.Drawing.Point(264, 8);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.ReadOnly = true;
this.nameTextBox.Size = new System.Drawing.Size(112, 20);
this.nameTextBox.TabIndex = 1;
this.nameTextBox.Text = "";
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("en-US");
//
// deptTextBox
//
this.deptTextBox.DataBindings.Add(new System.Windows.Forms.Binding
("Text", this.dataSet11, "tblID.Dept"));
this.deptTextBox.Location = new System.Drawing.Point(264, 32);
this.deptTextBox.Name = "deptTextBox";
this.deptTextBox.ReadOnly = true;
this.deptTextBox.Size = new System.Drawing.Size(112, 20);
this.deptTextBox.TabIndex = 2;
this.deptTextBox.Text = "";
//
// idTextBox
//
this.idTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text",
this.dataSet11, "tblID.ID"));
this.idTextBox.Location = new System.Drawing.Point(264, 56);
this.idTextBox.Name = "idTextBox";
this.idTextBox.ReadOnly = true;
this.idTextBox.Size = new System.Drawing.Size(112, 20);
this.idTextBox.TabIndex = 3;
this.idTextBox.Text = "";
//
// ageTextBox
//
this.ageTextBox.DataBindings.Add(new System.Windows.Forms.Binding
("Text", this.dataSet11, "tblID.Age"));
this.ageTextBox.Location = new System.Drawing.Point(264, 80);
this.ageTextBox.Name = "ageTextBox";
this.ageTextBox.ReadOnly = true;
this.ageTextBox.Size = new System.Drawing.Size(112, 20);
this.ageTextBox.TabIndex = 4;
this.ageTextBox.Text = "";
//
// deptLabel
//
this.deptLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.deptLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.deptLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.deptLabel.Location = new System.Drawing.Point(160, 32);
this.deptLabel.Name = "deptLabel";
this.deptLabel.Size = new System.Drawing.Size(96, 16);
this.deptLabel.TabIndex = 5;
this.deptLabel.Text = "Dept";
this.deptLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// idLabel
//
this.idLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.idLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.idLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.idLabel.Location = new System.Drawing.Point(160, 56);
this.idLabel.Name = "idLabel";
this.idLabel.Size = new System.Drawing.Size(96, 16);
this.idLabel.TabIndex = 6;
this.idLabel.Text = "ID";
this.idLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// ageLabel
//
this.ageLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.ageLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.ageLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ageLabel.Location = new System.Drawing.Point(160, 80);
this.ageLabel.Name = "ageLabel";
this.ageLabel.Size = new System.Drawing.Size(96, 16);
this.ageLabel.TabIndex = 7;
this.ageLabel.Text = "Age";
this.ageLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// kidPicture
//
this.kidPicture.Image = ((System.Drawing.Image)(resources.GetObject
("kidPicture.Image")));
this.kidPicture.Location = new System.Drawing.Point(24, 32);
this.kidPicture.Name = "kidPicture";
this.kidPicture.Size = new System.Drawing.Size(112, 96);
this.kidPicture.TabIndex = 8;
this.kidPicture.TabStop = false;
this.kidPicture.Visible = false;
//
// teenPicture
//
this.teenPicture.Image = ((System.Drawing.Image)(resources.GetObject
("teenPicture.Image")));
this.teenPicture.Location = new System.Drawing.Point(24, 24);
this.teenPicture.Name = "teenPicture";
this.teenPicture.Size = new System.Drawing.Size(112, 120);
this.teenPicture.TabIndex = 9;
this.teenPicture.TabStop = false;
this.teenPicture.Visible = false;
//
// adultPicture
//
this.adultPicture.Image = ((System.Drawing.Image)(resources.GetObject
("adultPicture.Image")));
this.adultPicture.Location = new System.Drawing.Point(40, 32);
this.adultPicture.Name = "adultPicture";
this.adultPicture.Size = new System.Drawing.Size(80, 96);
this.adultPicture.TabIndex = 10;
this.adultPicture.TabStop = false;
this.adultPicture.Visible = false;
//
// createButton
//
this.createButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.createButton.Location = new System.Drawing.Point(280, 192);
this.createButton.Name = "createButton";
this.createButton.Size = new System.Drawing.Size(112, 24);
this.createButton.TabIndex = 11;
this.createButton.Text = "Create ID";
this.createButton.Click += new System.EventHandler
(this.createButton_Click);
//
// clearButton
//
this.clearButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.clearButton.Location = new System.Drawing.Point(184, 192);
this.clearButton.Name = "clearButton";
this.clearButton.Size = new System.Drawing.Size(88, 24);
this.clearButton.TabIndex = 12;
this.clearButton.Text = "Clear";
this.clearButton.Click += new System.EventHandler(this.clearButton_Click)
;
//
// exitButton
//
this.exitButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.exitButton.Location = new System.Drawing.Point(88, 192);
this.exitButton.Name = "exitButton";
this.exitButton.Size = new System.Drawing.Size(88, 24);
this.exitButton.TabIndex = 13;
this.exitButton.Text = "Exit";
this.exitButton.Click += new System.EventHandler(this.exitButton_Click);
//
// idAgeLabel
//
this.idAgeLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.idAgeLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.idAgeLabel.ForeColor =
System.Drawing.SystemColors.ActiveCaptionText;
this.idAgeLabel.Location = new System.Drawing.Point(168, 96);
this.idAgeLabel.Name = "idAgeLabel";
this.idAgeLabel.Size = new System.Drawing.Size(96, 16);
this.idAgeLabel.TabIndex = 21;
this.idAgeLabel.Text = "Age";
this.idAgeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// idIDLabel
//
this.idIDLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.idIDLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.idIDLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.idIDLabel.Location = new System.Drawing.Point(168, 72);
this.idIDLabel.Name = "idIDLabel";
this.idIDLabel.Size = new System.Drawing.Size(96, 16);
this.idIDLabel.TabIndex = 20;
this.idIDLabel.Text = "ID";
this.idIDLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// idDeptLabel
//
this.idDeptLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.idDeptLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.idDeptLabel.ForeColor =
System.Drawing.SystemColors.ActiveCaptionText;
this.idDeptLabel.Location = new System.Drawing.Point(168, 48);
this.idDeptLabel.Name = "idDeptLabel";
this.idDeptLabel.Size = new System.Drawing.Size(96, 16);
this.idDeptLabel.TabIndex = 19;
this.idDeptLabel.Text = "Dept";
this.idDeptLabel.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;
//
// idNameLabel
//
this.idNameLabel.BackColor = System.Drawing.Color.DeepSkyBlue;
this.idNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (
(System.Byte)(0)));
this.idNameLabel.ForeColor =
System.Drawing.SystemColors.ActiveCaptionText;
this.idNameLabel.Location = new System.Drawing.Point(168, 24);
this.idNameLabel.Name = "idNameLabel";
this.idNameLabel.Size = new System.Drawing.Size(96, 16);
this.idNameLabel.TabIndex = 14;
this.idNameLabel.Text = "Name";
this.idNameLabel.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;
//
// inAgeLabel
//
this.inAgeLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.inAgeLabel.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.inAgeLabel.Location = new System.Drawing.Point(280, 96);
this.inAgeLabel.Name = "inAgeLabel";
this.inAgeLabel.Size = new System.Drawing.Size(96, 16);
this.inAgeLabel.TabIndex = 25;
this.inAgeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// inIDLabel
//
this.inIDLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.inIDLabel.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.inIDLabel.Location = new System.Drawing.Point(280, 72);
this.inIDLabel.Name = "inIDLabel";
this.inIDLabel.Size = new System.Drawing.Size(96, 16);
this.inIDLabel.TabIndex = 24;
this.inIDLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// inDeptLabel
//
this.inDeptLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.inDeptLabel.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.inDeptLabel.Location = new System.Drawing.Point(280, 48);
this.inDeptLabel.Name = "inDeptLabel";
this.inDeptLabel.Size = new System.Drawing.Size(96, 16);
this.inDeptLabel.TabIndex = 23;
this.inDeptLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// inNameLabel
//
this.inNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif",
9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.inNameLabel.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.inNameLabel.Location = new System.Drawing.Point(280, 24);
this.inNameLabel.Name = "inNameLabel";
this.inNameLabel.Size = new System.Drawing.Size(96, 16);
this.inNameLabel.TabIndex = 22;
this.inNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// IDgroupBox
//
this.IDgroupBox.Controls.Add(this.teenPicture);
this.IDgroupBox.Controls.Add(this.inAgeLabel);
this.IDgroupBox.Controls.Add(this.inIDLabel);
this.IDgroupBox.Controls.Add(this.inDeptLabel);
this.IDgroupBox.Controls.Add(this.adultPicture);
this.IDgroupBox.Controls.Add(this.idNameLabel);
this.IDgroupBox.Controls.Add(this.inNameLabel);
this.IDgroupBox.Controls.Add(this.idAgeLabel);
this.IDgroupBox.Controls.Add(this.idIDLabel);
this.IDgroupBox.Controls.Add(this.kidPicture);
this.IDgroupBox.Controls.Add(this.idDeptLabel);
this.IDgroupBox.Location = new System.Drawing.Point(8, 240);
this.IDgroupBox.Name = "IDgroupBox";
this.IDgroupBox.Size = new System.Drawing.Size(392, 152);
this.IDgroupBox.TabIndex = 26;
this.IDgroupBox.TabStop = false;
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject
("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(16, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(112, 120);
this.pictureBox1.TabIndex = 27;
this.pictureBox1.TabStop = false;
//
// oleDbConnection1
//
this.oleDbConnection1.ConnectionString = @"Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Data
Source=""C:\Temp\Nick\chlamnE1\ChlamnE1\EmployeeID.mdb"";Mode=Share Deny
None;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=;Jet OLEDB:Compact Without Replica
Repair=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System
Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;User
ID=Admin;Jet OLEDB:Global Bulk Transactions=1";
//
// oleDbDataAdapter1
//
this.oleDbDataAdapter1.DeleteCommand = this.oleDbDeleteCommand1;
this.oleDbDataAdapter1.InsertCommand = this.oleDbInsertCommand1;
this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1;
this.oleDbDataAdapter1.TableMappings.AddRange(new
System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table",
"tblID", new System.Data.Common.DataColumnMapping[] {
new
System.Data.Common.DataColumnMapping("ID1", "ID1"),
new
System.Data.Common.DataColumnMapping("name", "name"),
new
System.Data.Common.DataColumnMapping("ID", "ID"),
new
System.Data.Common.DataColumnMapping("Dept", "Dept"),
new
System.Data.Common.DataColumnMapping("Age", "Age")})});
this.oleDbDataAdapter1.UpdateCommand = this.oleDbUpdateCommand1;
//
// oleDbDeleteCommand1
//
this.oleDbDeleteCommand1.CommandText = "DELETE FROM tblID WHERE (ID1 = ?)
AND (Age = ? OR ? IS NULL AND Age IS NULL) AND " +
"(Dept = ? OR ? IS NULL AND Dept IS NULL) AND (ID = ? OR ? IS NULL AND
ID IS NULL" +
") AND (name = ? OR ? IS NULL AND name IS NULL)";
this.oleDbDeleteCommand1.Connection = this.oleDbConnection1;
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_ID1",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "ID1", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Age",
System.Data.OleDb.OleDbType.SmallInt, 0,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Age", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Age1",
System.Data.OleDb.OleDbType.SmallInt, 0,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Age", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Dept",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Dept", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Dept1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Dept", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_ID",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "ID", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_ID2",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "ID", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_name",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "name", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_name1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "name", System.Data.DataRowVersion.Original, null));
//
// oleDbInsertCommand1
//
this.oleDbInsertCommand1.CommandText = "INSERT INTO tblID(name, ID,
Dept, Age) VALUES (?, ?, ?, ?)";
this.oleDbInsertCommand1.Connection = this.oleDbConnection1;
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("name",
System.Data.OleDb.OleDbType.VarWChar, 50, "name"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("ID",
System.Data.OleDb.OleDbType.VarWChar, 50, "ID"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Dept",
System.Data.OleDb.OleDbType.VarWChar, 50, "Dept"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Age",
System.Data.OleDb.OleDbType.SmallInt, 0, "Age"));
//
// oleDbSelectCommand1
//
this.oleDbSelectCommand1.CommandText = "SELECT ID1, name, ID, Dept, Age
FROM tblID";
this.oleDbSelectCommand1.Connection = this.oleDbConnection1;
//
// oleDbUpdateCommand1
//
this.oleDbUpdateCommand1.CommandText = "UPDATE tblID SET name = ?, ID = ?
, Dept = ?, Age = ? WHERE (ID1 = ?) AND (Age = ?" +
" OR ? IS NULL AND Age IS NULL) AND (Dept = ? OR ? IS NULL AND Dept IS
NULL) AND " +
"(ID = ? OR ? IS NULL AND ID IS NULL) AND (name = ? OR ? IS NULL AND
name IS NULL" +
")";
this.oleDbUpdateCommand1.Connection = this.oleDbConnection1;
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("name",
System.Data.OleDb.OleDbType.VarWChar, 50, "name"));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("ID",
System.Data.OleDb.OleDbType.VarWChar, 50, "ID"));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Dept",
System.Data.OleDb.OleDbType.VarWChar, 50, "Dept"));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Age",
System.Data.OleDb.OleDbType.SmallInt, 0, "Age"));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_ID1",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "ID1", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Age",
System.Data.OleDb.OleDbType.SmallInt, 0,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Age", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Age1",
System.Data.OleDb.OleDbType.SmallInt, 0,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Age", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Dept",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Dept", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_Dept1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "Dept", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_ID",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "ID", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_ID2",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "ID", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_name",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "name", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Original_name1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), (
(System.Byte)(0)), "name", System.Data.DataRowVersion.Original, null));
//
// LastButton
//
this.LastButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.LastButton.Location = new System.Drawing.Point(328, 128);
this.LastButton.Name = "LastButton";
this.LastButton.Size = new System.Drawing.Size(40, 24);
this.LastButton.TabIndex = 28;
this.LastButton.Text = "| >";
this.LastButton.Click += new System.EventHandler(this.LastButton_Click);
//
// NextButton
//
this.NextButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.NextButton.Location = new System.Drawing.Point(280, 128);
this.NextButton.Name = "NextButton";
this.NextButton.Size = new System.Drawing.Size(40, 24);
this.NextButton.TabIndex = 29;
this.NextButton.Text = ">";
this.NextButton.Click += new System.EventHandler(this.NextButton_Click);
//
// PrevButton
//
this.PrevButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.PrevButton.Location = new System.Drawing.Point(232, 128);
this.PrevButton.Name = "PrevButton";
this.PrevButton.Size = new System.Drawing.Size(40, 24);
this.PrevButton.TabIndex = 30;
this.PrevButton.Text = "<";
this.PrevButton.Click += new System.EventHandler(this.PrevButton_Click);
//
// FirstButton
//
this.FirstButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.FirstButton.Location = new System.Drawing.Point(184, 128);
this.FirstButton.Name = "FirstButton";
this.FirstButton.Size = new System.Drawing.Size(40, 24);
this.FirstButton.TabIndex = 31;
this.FirstButton.Text = "< |";
this.FirstButton.Click += new System.EventHandler(this.FirstButton_Click)
;
//
// saveButton
//
this.saveButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.saveButton.Location = new System.Drawing.Point(280, 160);
this.saveButton.Name = "saveButton";
this.saveButton.Size = new System.Drawing.Size(80, 24);
this.saveButton.TabIndex = 32;
this.saveButton.Text = "Save";
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
//
// newButton
//
this.newButton.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.newButton.Location = new System.Drawing.Point(192, 160);
this.newButton.Name = "newButton";
this.newButton.Size = new System.Drawing.Size(80, 24);
this.newButton.TabIndex = 33;
this.newButton.Text = "New";
this.newButton.Click += new System.EventHandler(this.newButton_Click);
//
// ID1TextBox
//
this.ID1TextBox.DataBindings.Add(new System.Windows.Forms.Binding
("Text", this.dataSet11, "tblID.ID1"));
this.ID1TextBox.Location = new System.Drawing.Point(264, 104);
this.ID1TextBox.Name = "ID1TextBox";
this.ID1TextBox.ReadOnly = true;
this.ID1TextBox.Size = new System.Drawing.Size(56, 20);
this.ID1TextBox.TabIndex = 34;
this.ID1TextBox.Text = "";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ClientSize = new System.Drawing.Size(416, 237);
this.Controls.Add(this.ID1TextBox);
this.Controls.Add(this.newButton);
this.Controls.Add(this.saveButton);
this.Controls.Add(this.FirstButton);
this.Controls.Add(this.PrevButton);
this.Controls.Add(this.NextButton);
this.Controls.Add(this.LastButton);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.IDgroupBox);
this.Controls.Add(this.exitButton);
this.Controls.Add(this.clearButton);
this.Controls.Add(this.createButton);
this.Controls.Add(this.ageLabel);
this.Controls.Add(this.idLabel);
this.Controls.Add(this.deptLabel);
this.Controls.Add(this.ageTextBox);
this.Controls.Add(this.idTextBox);
this.Controls.Add(this.deptTextBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
this.IDgroupBox.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void Form1_Load(object sender, System.EventArgs e)
{
oleDbDataAdapter1.Fill(dataSet11,"tblID");
}


private void exitButton_Click(object sender, System.EventArgs e)
{
this.Close();
}

private void clearButton_Click(object sender, System.EventArgs e)
{
ClearID();
ClearInput();
this.Height = 208;
}

private void createButton_Click(object sender, System.EventArgs e)
{
CheckifBlank();
FillID();
CheckifFilled();
CheckAge();

}
private void ClearID()
{
inNameLabel.Text = "";
inDeptLabel.Text = "";
inIDLabel.Text = "";
inAgeLabel.Text = "";

adultPicture.Visible = false;
kidPicture.Visible = false;
teenPicture.Visible = false;
}
private void ClearInput()
{
nameTextBox.Clear();
deptTextBox.Clear();
idTextBox.Clear();
ageTextBox.Clear();
}
private void CheckifBlank()
{
if(nameTextBox.Text == "" && deptTextBox.Text == "" && idTextBox.Text ==
"" && ageTextBox.Text == "")
{
MessageBox.Show("Please Enter All Data");
nameTextBox.Focus();
}

else if (nameTextBox.Text == "")
{
MessageBox.Show("Input Name");
nameTextBox.Focus();
}
else if(deptTextBox.Text == "")
{
MessageBox.Show("Input Department");
deptTextBox.Focus();
}
else if (idTextBox.Text == "")
{
MessageBox.Show("Input ID");
idTextBox.Focus();
}
else if (ageTextBox.Text == "")
{
MessageBox.Show("Input Age");
idTextBox.Focus();
}

}
private void CheckAge()
{
int intAge = 0;
if (ageTextBox.Text != "")
{

try
{
intAge = int.Parse(ageTextBox.Text.Trim());
}
catch (FormatException myErr)
{
MessageBox.Show ("Error in input data:" + myErr.Message);
this.Height = 208;
ClearID();
ClearInput();
}


if(intAge < 18 )
{
kidPicture.Visible = true;
}
if(intAge >= 18 && intAge < 30)
{
teenPicture.Visible = true;
}
if(intAge >=30)
{
adultPicture.Visible = true;
}
}

}
private void FillID()
{
inNameLabel.Text = nameTextBox.Text;
inDeptLabel.Text = deptTextBox.Text;
inIDLabel.Text = idTextBox.Text;
inAgeLabel.Text = ageTextBox.Text;

}
private void CheckifFilled()
{
if(inNameLabel.Text != "" && inDeptLabel.Text != "" && inIDLabel.Text !=
"" && inAgeLabel.Text != "")
{

this.Height = 432;



}
}

// Database proceesing code

private void Bind()
{




}

private void LastButton_Click(object sender, System.EventArgs e)
{
this.BindingContext[dataSet11, "tblID"].Position = this.BindingContext
[dataSet11, "tblID"].Count - 1;
}

private void NextButton_Click(object sender, System.EventArgs e)
{
if(this.BindingContext[dataSet11,"tblID"].Position ==
this.BindingContext[dataSet11, "tblID"].Count - 1)
{
MessageBox.Show("end of file");
}
else
this.BindingContext[dataSet11,"tblID"].Position +=1;
}

private void PrevButton_Click(object sender, System.EventArgs e)
{
this.BindingContext[dataSet11,"tblID"].Position -=1;
}

private void FirstButton_Click(object sender, System.EventArgs e)
{
this.BindingContext[dataSet11,"tblID"].Position = 0;
}
private void save()
{
this.CheckifBlank();
DataSet insertrow = new DataSet();
DataSet modrow = new DataSet();
DataSet delrow= new DataSet();

insertrow = dataSet11.GetChanges(DataRowState.Added);
modrow = dataSet11.GetChanges(DataRowState.Modified);
delrow = dataSet11.GetChanges(DataRowState.Deleted);
try
{
oleDbDataAdapter1.Update(insertrow);
}
catch (FormatException myErr)
{
MessageBox.Show ("Error in input data:" + myErr.Message);
}

oleDbDataAdapter1.Update(modrow);
oleDbDataAdapter1.Update(delrow);

dataSet11.AcceptChanges();
}

private void saveButton_Click(object sender, System.EventArgs e)
{
save();
}

private void newButton_Click(object sender, System.EventArgs e)
{
nameTextBox.ReadOnly = false;
deptTextBox.ReadOnly = false;
idTextBox.ReadOnly = false;
ageTextBox.ReadOnly = false;
ID1TextBox.ReadOnly = false;
this.BindingContext[dataSet11,"tblID"].AddNew();
}

}
}
 
N

NicK chlam via DotNetMonster.com

in the save function where the dataset is returning null values
 
L

Landi

In that case you need to alter your SQL code and make it so that it doesn't
return null. Or you can check values returned to make sure they are not
DBNull in your C# code. That will fix it too. It was a long time ago since
I did this so I don't remember how to do exactly. Search the net for DBNull
and I am sure that will get a lot of stuff.

I have some stuff on the site that might help you out.
http://dowhileloop.com/publicjoe/vbsamples/sam-5199.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top