I'm beginning to understand the connections required to return information from your database. I'm now trying to return multiple lines from the database that have the same "prefix" within the part number. As my example, I have two records within my database that both start with "AO0025". I need to return both examples to two combo boxes. Here is what my code looks like now:
Dim connstr = "Data Source=.;AttachDbFilename=C:\Users\Don\Documents\DataDesignSolutions.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" Dim search1 As String = "'%" & txbxCustomerName.Text & "%'" Dim sqlquery = "SELECT [ARC-CUSTOMER-NAME], [ARC-CUSTOMER-NUMBER] FROM [AR_CUSTOMERS] where [ARC-CUSTOMER-NAME] like " & search1 Dim connection As SqlConnection = New SqlConnection(connstr) connection.Open() Dim command As SqlCommand = connection.CreateCommand() command.CommandText = sqlquery Dim reader As SqlDataReader = command.ExecuteReader() reader.Read() frmPopup.Show() frmPopup.Controls.Add(cbxPartNumber) frmPopup.Controls.Add(txbPartDesc) cbxPartNumber.Visible = True txbPartDesc.Visible = True cbxPartNumber.Text = reader.GetString(0) txbPartDesc.Text = reader.GetString(1) connection.Close()
Currently I've made provisions for 1 combobox and 1 textbox to list the partnumber and the part description. I know I'll need to add another combobox and textbox to show the second record. But how do I return both records?
In advance, thanks for your help!