Using the Binding Navigator to Select a Record

R

Randy

Hi,
I'm trying to figure out some binding navigator code. If I have the
primary field value as selected by the user in a combo box, how can I
instruct the binding navigator to move to that record. Here is what I
have so far:

Dim strSQL As String
strSQL = "SELECT OrderID WHERE OrderID = @OrderID"
Dim cmdSelect As New SqlCommand(strSQL, cn)
cmdSelect.Parameters.AddWithValue("@OrderID, cboOrderID.text)

bnOrders.Move????

I'd like to know what the binding navigator code is to instruct it to
move to the specific record returned by this query. If I can do it by
using the cboOrderID.text value, that would be simplest. If I need to
use the row number from the table "Orders", can somebody please tell
me what the code is to find the row number?

Thanks a lot,
Randy
 
R

Randy

That works just fine, although it works on the binding source (rather
than the binding navigator). Sorry about the term "record". Wasn't
trying to be technical, just a generic use of the term.

Using this property, I need to pass an integer to reference the row
number within the binding source to tell the app which row to move
to. I've searched this board and other places to find out how to
query this, to no avail. This binding source uses just one sql
datatable.

Can anybody tell me how to do this? Also, if there is a better way to
move directly to an item in the binding source based on a user
selected primary key, I'm all ears.

Thanks, Cor. And thanks to anybody else who might have advice for me.

Randy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top