I have a text box which I search SQL server which returns to values based on the text I pass the SP and then I want to add to the list box items so here is my code below
the DataTable contains the item I want to return in the list, I have used this syntax to populate a Datagrid with no problems, but I can`t seem to add the item in the listbox can anyone help thanks
Dim SPName As SqlCommand
Dim DbAdapter As New SqlDataAdapter
Dim DTptntData As New DataTable
SPName = New SqlCommand("myDB.dbo.Get_Coders_ICD10", EcnConn) 'running a stored procedure
SPName.CommandType = CommandType.StoredProcedure
Dim Param1 As SqlParameter = SPName.Parameters.Add("@ICDCode", SqlDbType.Char, 5)
Param1.Value = txtICD.Text.Trim
Try
SPName.Connection.Open()
SPName.CommandTimeout = 0
DbAdapter = New SqlDataAdapter(SPName)
DbAdapter.Fill(DTptntData)
lstDiag.Items.Add(DTptntData)
Catch ex As Exception
MsgBox(ex.Message)
End Try
SPName.Dispose()
EcnConn.Close()