469,934 Members | 1,974 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

Populate dropdown list with parameterized stored procedure.

I'm building a windows form application in Visual C# using VS 2005. On my form I need to populate a combobox with Invoices# linked to the current reccord's Order# value. This means that:
- The combobox should repopulate if the user changes the value of Order#.
- The combobox should repopulate if the user moves through records (using the binding navigator.

My problem is that whenever I repopulate the combobox, it's value is reset to the top value of the list. For example, the order# 366 populates the dropdown list with values 566, 567, 568. If a user selects Invoice# 567 and save record, it will be reseted to 566 as soon as he move to the next record and go back to this one.

How it's done:
So far, I created a stored procedure in SQL server 2005 that connects to my oracle server and returns a set of invoice numbers denpending on parameter @OrderNum.

In VS, my dataset has an RMA table adapter (This is the main table, the one the Form is build on and which the bindingnavigator move through). I also have a table adapter called "Invoice" that expects a parameter and which calls the stored procedure.

On my form, I display RMA info including the curent's RMA Order# and a combobox to select one of the Invoice# linked to this Order#. The combobox is linked to the InvoiceBindingSource, has Invoice as DisplayMember and ValueMember and the current reccord's Invoice# as SelectedValue

Finally, on the OnTextChange event of the Order# text box, I have the following code:

InvoiceNum_ComboBox.DataSource = InvoiceTableAdapter.GetInvoices(OrderNum_TextBox.T ext);

Very simple to code but, the results are not as expected.

I searched MSDN but I can't find a recommended way to code this.

Any advice?
Nov 27 '07 #1
0 2433

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Mark Goldin | last post: by
2 posts views Thread by Irishmaninusa | last post: by
3 posts views Thread by JIM.H. | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.