HLP: How to Match up DB Columns Info

  • Thread starter Thread starter Mr. B
  • Start date Start date
M

Mr. B

VB.net and two MS Access Data Bases...

In DB1, there is 2 (out of several) columns which are named CODE and
DESCRIPTION.

In DB2, there is only the CODE column (having the same code numbers as DB1).

I read the DB2 columns and put the CODE information in a ListBox.

What I want to be able to do, is to be able to select one of the CODE items
from the ListBox and be able to find the corresponding DESCRIPTION from DB2.

I can get the CODE item from the ListBox. Just don't know how to find the
DESCRIPTION from the other DB file. I need some sort of binding code here or
something.

Any ideas appreciated.

Regards,

Bruce
 
Hi,

What you could do here is execute query with parameters, where parameter
will be that code, which you selected

Dim objCmd as ADODB.Command
Dim objRS as ADODB.Recordset

Set objCmd = New ADODB.Command
Set objRS = New ADODB.Recordset

Set objCmd.ActiveConnection = objConn

objCmd.CommandText = "SELECT [DESCRIPTION] FROM DB1 WHERE
Code:
 = ?"
objCmd.CommandType = adCmdText

Set objParam = objCmd.CreateParameter("@Code" , adInteger, adParamInput, 0,
0)
objCmd.Parameters("@Code")>value = MySelectedCodeHere
objCmd.Parameters.Append objParam

Set objRS   = objCmd.Execute
 
Val Mazur said:
What you could do here is execute query with parameters, where parameter
will be that code, which you selected

Thanks Val... will try this out.

Regards,

Bruce
 
Back
Top