Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello. I'm having trouble with my application. The code only pick ups and shows the same invoice even if the invoice id isn't there. As

Hello. I'm having trouble with my application. The code only pick ups and shows the same invoice even if the invoice id isn't there. As long as I enter an integer, it shows the same result. Any help will be much appreciated.

My Code:

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SqlClient; namespace InvoiceLineItems { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void fillByInvoiceIDToolStripButton_Click(object sender, EventArgs e) { try { int InvoiceID = Convert.ToInt32( invoiceIDToolStripTextBox.Text); this.invoiceLineItemsTableAdapter.FillByInvoiceID( this.MMABooksDataSet1.InvoiceLineItems, InvoiceID); this.invoicesTableAdapter.FillByInvoiceID( this.MMABooksDataSet1.Invoices, InvoiceID); if (invoiceLineItemsBindingSource.Count > 0) this.invoicesTableAdapter.FillByInvoiceID( this.MMABooksDataSet1.Invoices, InvoiceID); else MessageBox.Show("No invoice found with this ID. " + "Please try again.", "Invoice Not Found"); } catch (FormatException) { MessageBox.Show("Invoice ID must be an integer.", "Entry Error"); } catch (SqlException ex) { MessageBox.Show("Database error # " + ex.Number + ": " + ex.Message, ex.GetType().ToString()); } } } }

Edit: What kind of information do you need? If you need more information, please be specific as "need more information" is not clear, nor helpful.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions