Hi jmcilhinney
I check out your first link it was definitely useful and educational , but I think and don't quote me on this its not related to my error. as I am able to view the table "CustomerDetails" when I run the app , I have a first form call frmMain with three buttons one of them is " Add new Customer Record" up on clicking this event I am taken to the frmCustomerRecs form as you will notice I have added buttons as well as left the Navigation bar , when I click on the add new 'button' notice I get '-1' I don't know how I am getting this , also notice from the screen shot the navigation bar increments to '3' one fills in the data and clicks save , you can still view the data go back forth and even return back to the frmMain menu then return back and you will be able to view the data with out any errors. Now my problem is when I exit it don't save the data as if the heap was wipe clean and nothing was written in .mdf file.
I have work on this now for my second week without any result and I bet ya its something very , very simple that I have over look.
attach are screen shots and the code from frmCustomerRecs if you can replicate this problem and fix it please , please education me as i serious have drifted off to planet Mars.
sql queire to create the table
CREATE TABLE [dbo].[CustomerDetails] (
[CustomerID] INT IDENTITY (1, 1) NOT NULL,
[First Name] NCHAR (50) NULL,
[Surname] NCHAR (50) NULL,
[Company Name] NCHAR (50) NULL,
[Address1] NCHAR (100) NULL,
[PostCode] NCHAR (30) NULL,
[Telephone] NCHAR (50) NULL,
NCHAR (50) NULL,
[Business Customer] BIT NULL,
[Last Record Saved] DATETIME NULL,
PRIMARY KEY CLUSTERED ([CustomerID] ASC)
);
and the code from frmCustomerRecs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace rzMegaD
{ // start namespace
public partial class frmCustomerRecs : Form
{ // start partial class
public frmCustomerRecs()
{
InitializeComponent();
}
private void customerDetailsBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.customerDetailsBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.RZMegaDesktopDataSet);
}
private void frmCustomerRecs_Load(object sender, EventArgs e)
{
//TODO: This line of code loads data into the 'rZMegaDesktopDataSet.CustomerDetails' table. You can move, or remove it, as needed.
this.customerDetailsTableAdapter.Fill(this.RZMegaDesktopDataSet.CustomerDetails);
}
private void btnSave_Click(object sender, EventArgs e)
{
this.Validate();
this.customerDetailsBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.RZMegaDesktopDataSet);
this.customerDetailsTableAdapter.Update(this.RZMegaDesktopDataSet);
MessageBox.Show("Record Saved");
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Hide();
}
private void btnAddNew_Click(object sender, EventArgs e)
{
// add new record
this.customerDetailsBindingSource.AddNew();
}
private void btnRemove_Click(object sender, EventArgs e)
{
// remove current record
MessageBox.Show("Are you sure you want to remove this record !","", MessageBoxButtons.OKCancel);
this.customerDetailsBindingSource.RemoveCurrent();
}
private void btnLastRecord_Click(object sender, EventArgs e)
{
this.customerDetailsBindingSource.MoveLast(); // move to the last record
}
private void btnFirstRecord_Click(object sender, EventArgs e)
{
this.customerDetailsBindingSource.MoveFirst(); // go to first record
}
}
} // ending namespace
as you can see from the coding its very , very simple so why it doesn't work i don't fully understand
any support is welcome many thanks