472,796 Members | 2,228 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,796 software developers and data experts.

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 2617

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

Similar topics

by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
by: Mark Goldin | last post by:
How can I populate a dropdownlist with data from a database using Microsoft.ApplicationBlocks.Data ? Thanks
by: Irishmaninusa | last post by:
Hello Everyone, I am populating a dropdown control from a database where the data is datetime values. In my stored procedure I am ordering them by where the most recent is at the top and the...
by: JIM.H. | last post by:
Hello, I have two Tables: Table1: GroupID1, GroupName1 and Table2:GroupID2, GroupName2. I have only one dropdown list (DropDownList1) in my application and through a stored procedure I want to...
by: Sheldon Penner | last post by:
I have been trying to build a web form using the SQL Data Adapter Configuration Wizard to create a dataset based on a parameterized stored procedure. I find that if I select "Use existing stored...
by: Tom | last post by:
Looking for some help with stored procedure call issues. Conceptually, I need to pass a data structure as the sole parameter to the Oracle stored procedure. Sounds simple enough....but how? ...
by: Kay O'Keeffe | last post by:
Hello, I have written my own custom control and I want one of its properties to display as a dropdown list when clicked, so the user can select from the list, it would be similar to the asp...
by: Javilen | last post by:
Hello, Maybe one of you can offer a possible solution to the problem I have below. The request to me is to build a dynamically populating dropdown list from a text box.(something similar to...
by: ellen89 | last post by:
Hi All, I am new to this field, and is using VS.2005, language is C#. 1) created a database "Test" in sql 2005, had a table "NameList", a stored proc "GetAllName" 2) created a new website,...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.