Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi All,

 

I have the following 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!

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...