SQLCE tableadapter wont insert record?

benpaul

Member
Joined
Dec 30, 2008
Messages
7
Hi All,

I have the following code....

Code:
        private void button2_Click(object sender, EventArgs e)
        {
            decimal myAmount = System.Convert.ToDecimal(this.amountTextBox.Text);
            decimal myVat = System.Convert.ToDecimal(this.vatTextBox.Text);
            int mySupplier = System.Convert.ToInt32(this.supplierComboBox.SelectedValue);
            string myDescription = this.descriptionTextBox.Text;
            DateTime myDateAdded = DateTime.Parse(this.dateaddedDateTimePicker.Text);
            int myEventID = iPromote.eventID;
            int mySupplierID = System.Convert.ToInt32(this.supplierComboBox.SelectedValue);

            try
            {
                this.receiptsTableAdapter1.Insert(myAmount, myDescription, myVat, myDateAdded, myEventID, mySupplierID);
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }

It is basically, taking the values from my various text boxes on the form and trying to insert a new record in the database using those values...

This is creating no exceptions or any errors, however when I close the app and check the database, the table in the database doesnt contain any of the information i had hoped to write to it....

Can anyone spot any problems with the code?


I am very new to .NET!
 
I have solved this, it seems that this was always working. What actually happens is that becuase I chose to export the database with each build, when i choose to debug the app, it creates a build and copies in a database that overwrites the copy of the database that the previous build had created... overwriting the changes.

This does make debugging quite difficult for me, however now at least I can be sure of my code.
 
Back
Top