Dim strauto As String Dim name As String name = Trim(txtCompanyKeyContacts.Text) If name = "" Then Exit Sub Dim cnString As String = ConfigurationManager.ConnectionStrings("dbcon").ConnectionString Dim con As New SqlConnection(cnString) Using con strauto = "SELECT (FULL_NAME + ',' + Company + ',' + Status) as contact FROM name where FULL_NAME like '%" & Replace(name, "'", "''") & "%' " 'SELECT last_name,FULL_NAME + ',' + Company + ',' + Status as contact FROM name" con.Open() Dim cmd As New SqlCommand(strauto, con) Dim reader As SqlDataReader = cmd.ExecuteReader() Dim MyCollection As New AutoCompleteStringCollection() If reader.HasRows = True Then While reader.Read() ' MyCollection.Add(reader("FULL_NAME + ',' + Company + ',' + Status").ToString()) MyCollection.Add(reader("contact").ToString()) End While End If txtCompanyKeyContacts.AutoCompleteCustomSource = MyCollection con.Close() End Using
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)