It is working now. Thanks. Here is the final code. Yes, I needed a ) and I needed to select 'machine' as well. You guys are good; :-)
Code:Dim READER2 As SqlDataReader Dim SQL2 As New SqlClient.SqlCommand SQL2.CommandText = "SELECT MACHINETOOL.[TOOL], MACHINE.[MACHINE], MACHINE.[NAME] FROM MACHINETOOL " SQL2.CommandText += " INNER JOIN MACHINE ON MACHINE.[MACHINE] = MACHINETOOL.[MACHINE] " SQL2.CommandText += " WHERE(LTrim(RTrim(MACHINETOOL.[TOOL]))) = " & "'" & Trim(cboTool.Text) & "'" SQL2.Connection = Cnxn SQL2.CommandType = CommandType.Text READER2 = SQL2.ExecuteReader Using READER2 If READER2.HasRows Then While READER2.Read lstMachine.Items.Add(READER2("machine") & " - " & READER2("Name")) End While Else lstMachine.Items.Add("No machine found") End If End Using SQL2.Dispose() '===========================




Reply With Quote